How to add slug to the url where nodebb shows.
-
As tutorial, I could deploy nodebb on http://example.com .
However, I would like to show nodebb on http://example.com/nodebb .I tried coding like below, but it failed. Any help is appreciated.
config.json{ "url": "http://example.com/nodebb", "secret": "secret", "database": "mongo", "port": 4567, "mongo": { "host": "127.0.0.1", "port": "27017", "username": "nodebb", "password": "pass", "database": "nodebb" } }
and, nginx.conf
location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1/nodebb:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
-
@0-home your nginx config is wrong, I think. Try it like this:
nginx.conf
location /nodebb { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://localhost:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
-
@PitaJ
Thank you very much @night-gold!
now I could access to http://example.com:4567/nodebb.
but I couldn't open http://example.com/nodebb... is there any way to remove port number with this way? -
What happens when you access http://example.com/nodebb ? Does it error out, and if so what is the error? Have you reloaded nginx? Have you made sure the nginx configs are valid with
nginx -t
? -
@PitaJ
Thank you for your reply, and sorry for lack of information.http://35.198.197.213:4567/nodebb/ → success to show nodebb.
http://35.198.197.213/nodebb/ → return 404 on parent site(my case is wordpress on nginx).
http://35.198.197.213:4567/ → return misconfigured csrf error on nodebb.
http://35.198.197.213:4567/nodebb → return /nodebbcategories not found on nodebb.I reloaded nginx.
I setup and restart nodebb each time.nginx -t → syntax and test is successful.
now I am trying below
https://community.nodebb.org/topic/3324/nginx-error/18