Welcome! Log In Create A New Profile

Advanced

Configure multiple subdomains and location blocks for reverse-proxy.

April 19, 2014 04:50PM
I have not been able to successfully locate the information I need to do this since many of the examples online are our of date or use bad practices so I will ask here.

First, my setup is as follows:
1. domain_i_own.tld ==> my_public_ip
2. my_server running on port 8083
3. Firewall wide open

Requirement:
1. domain_i_own.tld/my_server ==> domain_i_own.tld:8083
2. subdomain01.domain_i_own.tld ==> domain_i_own.tld/my_server ==> domain_i_own.tld:8083

My configuration:

upstream my_server {
server localhost:8083;
}

server {
listen 0.0.0.0:80;
server_name domain_i_own.tld;
root /var/www/domain_i_own.tld;

location /my_server {
proxy_pass http://my_server;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect http://my_server http://$host;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

Result:
Not Found
The requested URL /my_server/ was not found on this server.
my_server HTTP Server listening at localhost Port 8083

If I directly go to http://domain_i_own.tld:8083 ==> Success.
If I directly go to http://10.0.0.1:8083 ===> Success.

Thus, I know the services are all running properly. However, the reverse proxy is not.

It is not clear, exactly, why this is happening.

Is the location block being ignored?

I would like to get this part solved before I tackle the subdomain problem.

Thanks in advance for any help you may be able to provide.
Subject Author Posted

Configure multiple subdomains and location blocks for reverse-proxy.

elmono April 19, 2014 04:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready