I've been running two domains on one IP for years using SSL. One is example.com and the other is other.com. example.com has three names with its SSL cert; example.com, www.example.com and dev.example.com. other.com has other.com and www.other.com.
For the first time, I started up dev.example.com by just copying the nginx config for example.com like so:
server {
listen 80;
server_name example.com www.example.com dev.example.com;
root /var/empty;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2;
server_name dev.example.com;
root /home/dev;
index index.html;
charset utf-8;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Xss-Protection "1; mode=block" always;
ssl on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
ssl_ciphers ...
...
}
server {
listen 443 ssl http2;
server_name example.com www.example.com;
root /home/example;
index index.html;
charset utf-8;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Xss-Protection "1; mode=block" always;
ssl on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
ssl_ciphers ...
...
}
Having done that, I can now access all three variations of example.com. However, none of other.com are accessible in that I get a (paraphrased):
SSL_protocol_error
and
This site is not serving securely
in Chrome while Firefox redirects to Google (my default home page).
The config for other.com is identical to example.com except for the dev subdomain. I did not set any location blocks for dev.example.com. The rest of the config file only contains ssl cert pointers and location blocks.
So I'm a bit confused as to why the dev subdomain took down other.com.