Zane Mcain
Zane Mcain

Reputation: 1

After SSL Conf. returning "welcome to nginx!"

Nginx noob here, I did look through all previous posts but couldn't find anything specific to my situation.

I'm trying to install a commercial SSL certificate on nginx. After configuring etc/nginx/sites-available/myapp with the following:

server {
    listen 80;
    server_name example.come www.example.com;
    rewrite ^/(.*) https://example.com/$1 permanent;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/user/example.com;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/djangodeploy/example.com/rex.sock;
    }
}

server {
    listen 443 ssl;
    server_name example.com www.example.come;
    ssl_certificate /home/user/example.com.chained.crt;
    ssl_certificate_key /home/user/example.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GC$
    ssl_prefer_server_ciphers on;
}

After checking syntax everything is fine. The https works well, however instead of serving the actual website it just returns "Welcome to nginx!"

I've also configured the http directive in /etc/nginx/nginx.conf to include:

http {
      ssl_certificate /home/user/example.com.chained.crt;
      ssl_certificate_key /home/user/example.com.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: $
      ssl_prefer_server_ciphers on;

I've heard gzip can cause problems, should I disable it?

Any help would be greatly appreciated!

Upvotes: 0

Views: 49

Answers (1)

Ryan Z
Ryan Z

Reputation: 2785

The HTTPS server block does not proxy to your application, so you will need to add the location / block to it, ending up with this:

server {
    listen 443 ssl;
    server_name example.com www.example.come;
    ssl_certificate /home/user/example.com.chained.crt;
    ssl_certificate_key /home/user/example.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GC$
    ssl_prefer_server_ciphers on;

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/djangodeploy/example.com/rex.sock;
    }
}

Upvotes: 1

Related Questions