Configure multiple subdomains and location blocks for reverse-proxy

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
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


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

My configuration:

upstream my_server {
server localhost:8083;

server {
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

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 ===> 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

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

Posted at Nginx Forum:,249404,249404#msg-249404

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs