need help on nginx server block
-
my current block is as followed
server {
listen 80;
server_name forum.abc.com;
return 301 $scheme://forum.abc.com$request_uri;
}URL: add a permanent redirect if required.
server {
listen 80;
server_name forum.abc.com;
root /home/abc/abcforum;
access_log /var/log/nginx/forum.abc.com.access.log;
error_log /var/log/nginx/forum.abc.com.error.log;
#include global/common.conf;
}I copied and modified it from my main wordpress server block.
Currently i can access forum.abc.com:4567 but i cant access it at forum.abc.com
How do I fix it?Thank you,
-
That is my server block to serve NodeBB. During setup, I set the NodeBB's URL to
127.0.0.1
at port4567
.server { listen 80; server_name forum.abc.me; location / { proxy_pass http://127.0.0.1:4567; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
This server block is saved as
nodebb.conf
in/etc/sites-available
, then symlinked to/etc/nginx/sites-enabled
by running the commandsudo ln -s /etc/sites-available/nodebb.conf /etc/nginx/sites-enabled/
. Of course, run thesudo service nginx reload
after that. -
@aixnr does it mean i dont have to include this section?
server {
listen 80;
server_name forum.abc.com;
root /home/abc/abcforum;
access_log /var/log/nginx/forum.abc.com.access.log;
error_log /var/log/nginx/forum.abc.com.error.log;
#include global/common.conf;
} -
@Pakorn I don't think you need. The
nginx
code block that I posted above is what I've been using on my NodeBB and couple of Ghost blogs before. It is just the matter of redirecting the traffic. -
During nodBB setup, I entered hostname as "forum.abc.com" so i should change server block to this?
server { listen 80; server_name forum.abc.com; location / { proxy_pass http://forum.abc.com:4567; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
-
@Pakorn yes you are right. Just checked my NodeBB's
config.json
. I puthttp://forum.abc.com
as the URL during the./nodebb setup
with the port6379
.