Gilberg
Gilberg

Reputation: 2564

Ubuntu Nginx new ssl certificate not working?

I am using ubuntu 14.04 and nginx.

I just generated my csr and bought an EV SSL cert from comodo. My .conf file in my sites-enabled directory is:

server {
    listen       80;
    server_name  example.com;
    return       301 https://www.example.com$request_uri;
}

server {
        listen 80;
        listen [::]:80;

        listen 443 ssl;

        root /var/www/example.com/public_html;
        index index.php index.html index.htm;

        server_name www.example.com;
        ssl_certificate /etc/nginx/ssl/example.crt;
        ssl_certificate_key /etc/nginx/ssl/example.key;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

   location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

I restarted a nginx but my http://www.example.com just times out as if I have done nothing. No errors in the nginx log. I have confirmed my files are in the right spots. Is there anything in my example.conf file that is preventing https from working? Also, comodo send me 4 files and I concatenated them all into the example.crt file, should I have concatenated it into a .PEM file instead?

I have also confirmed that the crt and key files match using the following commands:

openssl x509 -noout -modulus -in example.crt | openssl md5

openssl rsa -noout -modulus -in example.key | openssl md5

This is my first attempt at installing an ssl cert on nginx. Also, the cert is an interim one until comodo verifies my site.

Upvotes: 0

Views: 691

Answers (1)

Gilberg
Gilberg

Reputation: 2564

I found the problem. I am on EC2 and my instance didn't have a security group for port 443. I set one up and restarted and all was good.

Upvotes: 1

Related Questions