Question

Nginx returns 404 error for HTTPS connections - SSL HTTPS Nginx Meteor

Hi,

I’m running a Meteor app on a droplet, and I tried to follow this tutorial for setting up ssl and https connections: https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority

HTTP connections to bqscorekeeper.com still work, but for HTTPS connections, nginx returns 404 not found.

When I type “nginx -t”, this message is returned: nginx: [warn] conflicting server name “bqscorekeeper.com” on 0.0.0.0:80, ignored nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

I’m not sure what to do now. Here are two of my files from /etc/nginx/sites-enabled

bscorekeeper.com.conf:

server {
        listen 80;

        server_name bqscorekeeper.com www.bqscorekeeper.com *.bqscorekeeper.com 104.236.89.47;
        access_log /var/log/nginx/app.dev.access.log;
        error_log /var/log/nginx/app.dev.error.log;
        location / {
                proxy_pass http://104.236.89.47:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header X-Fowarded-For $remote_addr;
        }
}

default:

server {
        listen 80;
        server_name bqscorekeeper.com;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        location / {
                try_files $uri $uri/ =404;
        }
}


server {
        listen 443;
        server_name bqscorekeeper.com;


        root /user/share/nginx/html;
        index index.html index.htm;

        ssl on;
        ssl_certificate /root/bqscorekeeper.com.crt;
        ssl_certificate_key /root/bqscorekeeper.com.key;

        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
        location / {
                try_files $uri $uri/ =404;
        }
}
Subscribe
Share

Submit an 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.

You are setting the same thing twice under http (80) server_name bqscorekeeper.com;

Have a look at the configuration here to try and see why your https isn’t serving or finding the app properly. https://www.digitalocean.com/community/questions/cannot-configure-https-for-www-subdomain-using-nginx-server-blocks

Yes in the 80 block you need to redirect to the https one.