首页 > 解决方案 > Nginx 只显示欢迎页面

问题描述

我只是为子域设置了 nginx,即便如此,我仍然只得到欢迎页面。

这是我在 nginx sites-available 上设置的代码

server {
    listen 80;

    server_name sub.domain.ro;

    rewrite ^ https://sub.domain.ro$request_uri? permanent;
}

server {
    listen 443 ssl http2;

    # ssl_certificate /etc/letsencrypt/live/testsite.com/fullchain.pem;
    # ssl_certificate_key /etc/letsencrypt/live/testsite.com/privkey.pem;
    # ssl_stapling on;

    server_name sub.domain.ro;

    root /var/www/sub.domain.ro;

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

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

}

请让我知道我做错了什么或在这里忘记了什么。

标签: nginx

解决方案


推荐阅读