nginx server blocks not working

Issues related to applications and software problems
Post Reply
viziontechit
Posts: 1
Joined: 2020/08/02 05:18:46

nginx server blocks not working

Post by viziontechit » 2020/08/02 05:21:17

hey all, i have nginx with a server block setup secured with lets encrypt. but the server doesnt display the chosen root directory rather only the nginx test page. here is my config

Code: Select all

server {
    listen 80;

    server_name www.msdsecurity.com.au msdsecurity.com.au;
    include snippets/letsencrypt.conf;
    return 301 https://$host$request_uri;

    access_log /var/log/nginx/msdsecurity.com.au.access.log;
    error_log /var/log/nginx/msdsecurity.com.au.error.log;

    location / {
        try_files $uri $uri/ /index.php?$request_uri;
        root /var/www/msdsecurity.com.au/public_html;
    }
}

server {
    listen 443 ssl http2;
    server_name www.msdsecurity.com.au;
    ssl_certificate /etc/letsencrypt/live/msdsecurity.com.au/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/msdsecurity.com.au/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/msdsecurity.com.au/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    return 301 https://msdsecurity.com.au$request_uri;
}

server {
    listen 443 ssl http2;
    server_name msdsecurity.com.au;
    ssl_certificate /etc/letsencrypt/live/msdsecurity.com.au/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/msdsecurity.com.au/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/msdsecurity.com.au/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;
}

Post Reply