I have a server with multiple nginx instances
One of them is running at 8080
server {
listen 8080;
server_name myip v2.example.com www.v2.example.com;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
proxy_pass http://v2.example.com:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
But I want to enter the site using example.com , instead of example.com:8080
Problem is that there is another server running at port 80 , I tried to fix it with the proxy pass, but it doesn’t seem to work
How can I fix that?
2
Answers
You can try with ssl port
443
. Of course you may need to add a valid ssl certificate to avoid error messages from the browser.If you do not want to use the above method, you can use the proxy pass on one of your other instances as follows:
After that, You can then access it through: http://localhost:80/some-url/
Redirect with
return
. You can put the following in one file: