Nginx subdomain for different systems

0

I have an instance in google cloud that contains 2 systems 1 running on port 8000 and another on port 8080 and nginx already configured 8000 - > 80.

And I have a domain configured in the cloudflare with the following routes: myite.com and the subdomain subdomain.myusite.com

The miite.com entry for the service running on port 8000 is already working. I would like to point the subdomain to the service running on port 8080

'

              server {
                server_name meusite;

              location / {
                proxy_pass "http://127.0.0.1:8000";
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_cache_bypass $http_upgrade;
              }

                listen 443 ssl; # managed by Certbot
                ssl_certificate /etc/letsencrypt/live/meusite/fullchain.pem; # managed by Certbot
                ssl_certificate_key /etc/letsencrypt/live/meusite/privkey.pem; # managed by Certbot
                include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
                ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
            }
            server {
                if ($host = meusite) {
                    return 301 https://$host$request_uri;
                } # managed by Certbot
              listen 80;
              server_name meusite;
                return 404; # managed by Certbot
            }
            server {
              server_name subdominio.meusite;
              location / {
                proxy_pass "http://127.0.0.1:8080";
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_cache_bypass $http_upgrade;
              }
                listen 443 ssl; # managed by Certbot
                ssl_certificate /etc/letsencrypt/live/meusite/fullchain.pem; # managed by Certbot
                ssl_certificate_key /etc/letsencrypt/live/meusite/privkey.pem; # managed by Certbot
                include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
                ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
            }
            server {
                if ($host = subdominio.meusite) {
                    return 301 https://$host$request_uri;
                } # managed by Certbot
                 listen 80;
                server_name subdominio.meusite;
                return 404; # managed by Certbot
            }

'

    
asked by anonymous 01.03.2018 / 23:50

0 answers