Problem with nginx reverse proxy and subdomain
-
I have some problems with nginx. I would like nodebb to work on "http://forum.domainname.com". i had followed the ubuntu installation tutorial. But, this is how nodebb is working now:
http://forum.domainname.com -> redirect to https://forum.domainname.com/ -> timeout ... (i don't know why https)
http://forum.domainname.com:4567 -> work
http://domainname.com:4567 -> work
EDIT: http://domainname.com -> redirect to http://www.domainname.com/ -> workconfig.json
{ "url": "http://forum.domainname.com", "secret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "27017", "username": "nodebb", "password": "mypasswd", "database": "nodebb", "uri": "" }, "port": "4567" }
/etc/nginx/sites-available/forum.domainname.com
server { listen 80; listen [::]:80; server_name forum.domainname.com; 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:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Thank you in advance for your help
-
Try changing config.json to https://blablabla
-
try this configuration :
config.json
{ "url": "http://forum.domainname.com", "secret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "database": "mongo", "port": 4567, "mongo": { "host": "127.0.0.1", "port": "27017", "username": "nodebb", "password": "mypasswd", "database": "nodebb", } }
nginx host
/etc/nginx/sites-available/forum.domainname.com
server { listen 80; server_name forum.domainname.com; 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:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
-
@The-Worms said in Problem with nginx reverse proxy and subdomain:
You are redirected to https ?
YES, http://forum.domainname.com is redirecting by itself. I didn't configured it to redirect.
@The-Worms said in Problem with nginx reverse proxy and subdomain:
Do you have an https on your domain ?
https is not installed on the server yet, because i reinstalled the server several times and i have to wait a week to get new ssl certificates from lets encrypt. So, it is a fresh installed server without ssl.
@The-Worms said in Problem with nginx reverse proxy and subdomain:
/etc/nginx/sites-available/forum.domainname.com
is same ?
/etc/nginx/sites-enable/forum.domainname.com/etc/nginx/sites-enabled/forum.domainname.com is same thanks to a symlink
-
So the http is automatically redirecting to https? Is there any way you can disable that? Obviously if you don't have https set up on your server, the request to https will fail.
-
@The-Worms You find the problem. Thank you very much!
My browser cache was completly blocked. The button to empty the cache was disabled...
thankfully, firefox have a fast repare fonctionnality to reinitialize the browser. And now, nodebb is working great!
So, this was the problem since 2 days...
but, why http://domainname.com -> redirect to http://www.domainname.com/ -> and work ? is this normal nginx behavior because the domain is not configured yet?
-
but, why http://domainname.com -> redirect to http://www.domainname.com/ -> and work ? is this normal nginx behavior because the domain is not configured yet?
It's normal
server { listen 80; server_name domainname.com; [...] }