Whats wrong with this config?
I created this nginx config(using my own domain not example) and restarted nginx but when I went to the website it still directs me to the local server rather than the "remote" server I want it to
25 Replies
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close
!close
!solved
!answered
Requested by lavaking46#0
Where is the config placed?
If in sites-available did you create a symbolic link?
yes
^
Is there a other config that overrides this one
when you go to your domain, are you using http, or https?
Hm, try
nginx -t
to test the configs.
Wait, doesn't proxypass require a IP adress not a domain?
Also, what are you trying to do if I can ask?I tried with both http and https
To reply to all three of your questions:
1. I tested that and it says everything is good
2. I have no idea. I give it an ip-address I just put a placeholder there so as not to reveal that information
3. I have two physical servers in my network. I can only port forward to one of them because of my router. one of the servers needs to be the one port forwarded to but I still want to access what I am hosting on the other server
If they are on the same network shouldn't you port forward it to local network instead of public IP?
I have my portforwarding set up like this and it runs without any issues.
Also, is the port open on the second server?
yes
its not to a public IP its all internal
I just didn't share said IP
unrelated question. what is the x-forwarded-proto for?
It passes the protocol (HTTP, HTTPS, ..) to the proxy.
Oh, I was confused as I tought that you were using a public IP as there is no reason to censor localhost.
yeah I don't know why I thought I should censor it
Anyways, couple more ideas and then I have no clue what is wrong.
1. Any errors in the error log?
2. Try incognito mode, sometimes browser directly (skip the request entirely) redirect you to the wrong adress.
3. Try pinging the local address
4. Check once again for configuration conflicts (mainly default in
nginx/sites-enabled
, and check nginx/conf.d
I can connect to the local IP directly. the default config is disabled. I have another config but its set for a different domain entirely.
SSL error
2023/08/09 09:39:57 [error] 1259345#1259345: *4 SSL_do_handshake() failed (SSL: error:0A00010B:SSL routines::wrong version number) while SSL handshaking to upstream, client: IP, server: lavaking46.com, request: "GET / HTTP/1.1", upstream: "https://10.0.0.86:80/", host: "IP"
Connecting is not the same as pinging it as it might have some issues with that specific machine.
According to the error you are using https (443) while listening for http (80).
I tried connecting to the server with port 443 and it throws a bad request error.
switching my connection to http doesnt change anything
You said that you are running it locally, is it possible that the router is blocking the traffic and thus causing the "wrong version number" error?
router isn't blocking it. I just checked the logs
trying in incognito does the same thing.
it can ping the machine just fine. also the error occured earlier but no longer occurs
Alright, I have no clue what is wrong then, sorry.
Wym by "you can only port forward to one"?
Wait you're not the one using DMZ as "port forwarding", are you?
I have learned a lot of things about port forwarding. I hadn't entirely realized til now(it just didn't come to mind) that port forwarding has to assign each port to a specific internal ip and port meaning port forwarding always directs to one internal machine
I'm not using a DMZ no. I have been told to but I think its a bad idea
@lavaking46
the difference is the name of the domain + ip
It hid because no messages in a week
ah
ok
config for the site
nginx config:
!close
post closed!
The post/thread has been closed!
Requested by lavaking46#0