Step 1: Install NodeBB, Step 2: Set up reverse proxy?
-
@HolyPhoenix said:
ls
There aren't any files listed in that folder. Hmm...
In the "sites-available" folder, the ls command produced "default".
-
@Kamal-Patel
hmmm.... If I got to that point I would just add it to the standard nginx.conf at the bottom. The default file may work maybe...? I don't really know what that is for. If I got to that point I would just tack the proxy info to the bottom of the nginx.conf file. For me this is at /etc/nginx/nginx.conf.
Mine looks like
server { listen myipaddress:80; server_name domain.com www.domain.com; error_log path/to/logs 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"; } }
Edit: I don't know why it put some of it in a nice box. I don't know markup well enough to know why, but that whole section is there
-
As @HolyPhoenix suggested, you can place it at the bottom of the
nginx.conf
file. However....Purely for organization purposes, I prefer using the
sites-available
folder. Yournginx.conf
file is probably set up to look there already.Create a new file called whatever you want:
cd /etc/nginx/sites-available
touch hotpotato
Then edit this file:
nano hotpotato
Paste the config in there, altering as necessary, and then activate the file:
cd ../sites-enabled
ln -s ../sites-available
-
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 failedI 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 failedHere 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 -
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.
-
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
https://media.readthedocs.org/pdf/nodebb/latest/nodebb.pdf
I've changedserver { listen myipaddress:80; //........
and
sudo /etc/init.d/nginx restartThe result is same...
sub.mydomain.net
does not lead tomydomain.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 asmydomain.net
), and make sure that nginx is reading configuration files fromsites-enabled/
, you can check that by looking near the bottom ofnginx.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
-
-
This post is deleted!
-
This post is deleted!