Step 1: Install NodeBB, Step 2: Set up reverse proxy?

General Discussion
  • I tried what Julian said and got this message:

    ln: failed to create symbolic link `./sites-available': File exists

    And this error when running nginx -t:

    nginx: [crit] pread() "/etc/nginx/sites-enabled/sites-available" failed (21: Is a directory)
    nginx: configuration file /etc/nginx/nginx.conf test failed

    I tried all three of the methods listed in the documentation, but no dice. Any tips? I just did the regular digital ocean setup for dummies, but I can't get past the reverse proxy step even after reading every single mention of "nginx" on the forum. I feel like a grade-A moron 😞

    By the way, the site is at http://nutritionask.com:4567.

    When I use the nginx.conf file I paste the server block at the end and get this error:

    2014/05/16 15:33:47 [emerg] 30304#0: "server" directive is not allowed here in /etc/nginx/n ginx.conf:97
    nginx: configuration file /etc/nginx/nginx.conf test failed

    Here is what I pasted. How do you make it all cool looking with the black background btw?

    server {
    listen 0.0.0.0:80;

    server_name nutritionask.com;

    location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;

    proxy_pass http://127.0.0.1:4567/;
    proxy_redirect off;
    
    # Socket.IO Support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    

    }
    }

  • Seems like you linked the sites-available directory inside sites-enabled. Give this a shot:

    rm -rf /etc/nginx/sites-enabled/sites-available
    
    ln -s /etc/nginx/sites-available/hotpotato /etc/nginx/sites-enabled/hotpotato
    

    and then run nginx -t, if all checks out reboot nginx and hopefully you're good 🙂

  • @psychobunny

    You're a good luck charm! I moved the lines up into the http directive in the nginx.conf file, and it worked. I've been at this for a few days...is there any way that (if I learn a bit more about commands and such), I can help add a few more lines to the reverse proxy documentation page so that dummies like me won't screw up?

    Also, do you know if I have to delete the lines from the other locations I tried (sites-available, default) and remove the link? Just wanna make sure that having the same stuff in three different locations isn't gonna screw something up later.

  • @psychobunny @julian

    Thanks for this thread, and I think this kind of information can be placed in docs or wiki.

    I use nginx now, and the default page of mydomain.net works, and mydomain.net:4567 works for nodeBB.

    Now, I try to implement sub.mydomain.net proxy to 127.0.0.0:4567 (nodeBB), so I tried:

    /etc/nginx/sites-available/subdomain

    server {
          listen   myipaddress:80;
         server_name sub.mydomain.net;
         error_log ./log error;
    
         location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass      http://127.0.0.1:4567/;
            proxy_redirect off;
    
            # Sockect.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    
    

    But seems not working.

    I properly set the symbolic link in /etc/nginx/sites-enabled/

    ln -s /etc/nginx/sites-available/subdomain
    

    So here is no problem, I think.

    Please advice ,
    Thanks.

    PS. reading

    I've changed

    server {
          listen   myipaddress:80;
    //........
    

    and
    sudo /etc/init.d/nginx restart

    The result is same...
    sub.mydomain.net does not lead to mydomain.net:4567...

    Ubuntu 14.04
    nginx version: nginx/1.6.0

  • @Ken-OKABE What do you see when you go to sub.mydomain.net? An nginx error?

    Make sure the subdomain is routed properly via your DNS server (so that sub.mydomain.net goes to the same ip as mydomain.net), and make sure that nginx is reading configuration files from sites-enabled/, you can check that by looking near the bottom of nginx.conf.

  • @julian No, the browser says - Oops! Google Chrome could not find sub.mydomain.net

    Currently, I'm trying to figure out how to observe nginex behavior with log.

    So far, simply,
    mydomain.net shows the frontpage of nginex.
    mydomain.net/4567 shows the nodeBB properly.

    Thanks

  • @julian said:

    Make sure the subdomain is routed properly via your DNS server (so that sub.mydomain.net goes to the same ip as mydomain.net),

    Oh my... I totally miss it!

    You have true insights always. Appreciated Julian.

  • @julian Just works as intended.
    The approach here totally works.
    As you kindly suggested, it's my mistake not to have set subdomain by DNS.
    I somehow misunderstood Ngynx takes care of subdomainsDNS IP routing, my bad.
    Thanks a lot.

  • This post is deleted!
  • This post is deleted!


Suggested Topics