Jump to content

So i have this Nginx container running that should display the contents that i want to. so i have 2 domains which each have 2 sub domains.

 

Domain #1 = www.mydomain.com | mydomain.com                 >192.168.0.122  

Sub domain = dev.mydomain.com                                            >192.168.0.133

 

Domain #1 = www.projects.com | projects.com                        >192.168.0.144

Sub domain = dev.projects.com                                                >192.168.0.155

 

 

Now the Nginx config files

 

server {
    listen       443 ssl;
    server_name  www.mydomain.com mydomain.com;

    ########
	SSL STUFF
	########

    location / {
        proxy_pass http://192.168.0.122:80;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

server {
    listen       443 ssl;
    server_name  dev.mydomain.com;

    ########
	SSL STUFF
	########

    location / {
        proxy_pass http://192.168.0.133:80;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

server {
    listen       443 ssl;
    server_name  www.projects.com projects.com;

    ########
	SSL STUFF
	########

    location / {
        proxy_pass http://192.168.0.144:80;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

server {
    listen       443 ssl;
    server_name  dev.projects.com;

    ########
	SSL STUFF
	########

    location / {
        proxy_pass http://192.168.0.155:80;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

 

 

www.mydomain.com, mydomain.com, www.projects.com, projects.com works correctly..

 

But when i go to dev.mydomain.com or dev.projects.com

It wants to use the config i have setup for www.mydomain.com

 

 

 

Quote or mention me if not feel ignored 

Link to comment
https://linustechtips.com/topic/605532-nginx-reverse-proxy-ssl/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×