0

Everything is working fine until I install Let's encrypt and modify /etc/nginx/sites-available/default

What is the mistake I'm doing

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



        root /var/www/html;


        index index.php index.html index.htm index.nginx-debian.html;
    server_name geekdashboard.com www.geekdashboaard.com;
    return 301 https://$server_name$request_uri;
}

server {

    # SSL configuration

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/ssl-geekdashboard.com.conf;
    include snippets/ssl-params.conf;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
    }

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
    location ~ /.well-known {
                allow all;
}

}
2
  • 1
    Please describe your problem more fully, and detail the changes you made to move to SSL. Also please supply and relevant access / error log entries. I also note that your "well known" directory is only on SSL - the first time you try to get a certificate there's no https, so I wonder if this works.
    – Tim
    Mar 26, 2017 at 20:45
  • I followed this guide to setup SSL digitalocean.com/community/tutorials/… Mar 26, 2017 at 20:50

2 Answers 2

1

Your server block hasn't got a root directive to tell nginx where your web site's files are located. Thus it serves the files from the default location, which are the sample files shipped with nginx.

To solve the problem, add a proper root directive in the server block.

0

From snippets above, your root root /var/www/html; is pointing to the default nginx page. In case you have changed it and it still persist declare another root right below ;


listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; include snippets/ssl-geekdashboard.com.conf; include snippets/ssl-params.conf;

to have


listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; include snippets/ssl-geekdashboard.com.conf; include snippets/ssl-params.conf; #new path root /path/to/your/project

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.