Question
Best way to manage multiple domain with SSL in single droplet?
Hi everyone!
Firts of sorry about my poor english, but I’ll do my best. Currently I manage 2 domain in my $5 droplet and have use Cloudflare as my DNS manager with Flexible SSL configuration, everything works fine until I decide to change to Full SSL configuration with SSL certificate from Cloudflare.
Let say, my domains are domain.com and example.com. When I access them over HTTP both looks fine.
- http://example.com : showing right content from example.com which is WP site
- http://domain.com : showing right content from domain.com which is Jekyll generated HTML site
But, when I try to access it from HTTPS, it’s look odd.
- https://example.com : showing right content from example.com which is WP site
- https://domain.com : showing the content from example.com which is WP site?
Here my nginx example.com.conf
server {
listen 80;
listen 443 ssl;
server_name example.com;
root /var/www/sites/example.com/;
# Logging Settings
access_log /var/www/logs/example.com-access.log;
error_log /var/www/logs/example.com-error.log;
location / {
try_files $uri $uri/ /index.php;
index index.php index.html index.htm;
}
#ssl on;
ssl_certificate /var/www/certs/example.com.crt;
ssl_certificate_key /var/www/certs/example.com.key;
#ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1.2;
ssl_ciphers AES256+RSA:!aNULL;
ssl_prefer_server_ciphers on;
# Wordpress SEO
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
include /var/www/sites/example.com/nginx.conf;
include /etc/nginx/conf.d/error_page.conf;
include /etc/nginx/conf.d/common.conf;
include /etc/nginx/conf.d/phpcgi.conf;
}
and here from my domain.com.conf
server {
listen 80 default_server;
listen 433 ssl;
server_name domain.com;
root /var/www/sites/domain.com/;
# Logging Settings
access_log /var/www/logs/domain.com-access.log;
error_log /var/www/logs/domain.com-error.log;
location / {
index index.html index.htm;
}
#ssl on;
ssl_certificate /var/www/certs/domain.com.crt;
ssl_certificate_key /var/www/certs/domain.com.key;
#ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1.2;
ssl_ciphers AES256+RSA:!aNULL;
ssl_prefer_server_ciphers on;
include /etc/nginx/conf.d/error_page.conf;
include /etc/nginx/conf.d/common.conf;
#include /etc/nginx/conf.d/phpcgi.conf;
}
and here my /etc/hosts
file
127.0.0.1 localhost domain.com example.com
123.456.789.987 domain.com example.com
anyone have solution?
Thank you :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×