Report this

What is the reason for this report?

Best way to manage multiple domain with SSL in single droplet?

Posted on April 25, 2015

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.

But, when I try to access it from HTTPS, it’s look odd.

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Sorry it’s my bad, I had typo in domain.com.conf (thanks to @Ismooth in question comment)

You have a typo in your domain.com.conf listen 433 ssl; should be listen 443 ssl;

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.