为什么在我的 nginx 配置上使用别名和重定向会出现 404 错误?

为什么在我的 nginx 配置上使用别名和重定向会出现 404 错误?

我有以下针对 vhost 的 nginx 配置:

server {          
        listen 80;
        server_name guest8.ellak.gr;

        location /.well-known/acme-challenge {
            root /var/www/letsencrypt;
        }

    location / {
        rewrite ^ https://$server_name$request_uri? permanent;
    }
} 

server {

    listen 443 ssl; 

    #Change theese ones
        ssl_certificate     /etc/letsencrypt/live/guest8.ellak.gr/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/guest8.ellak.gr/privkey.pem;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         HIGH:!aNULL:!MD5;
    server_name guest8.ellak.gr;

    #To have one site for all piwik analytics
    location /piwik/ {
        error_page 502 /502.html;

        proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_cache_bypass $http_upgrade;

            proxy_pass http://0.0.0.0:8081;
                proxy_set_header Host guest8.ellak.org;
    }

    location /mailcow/ {
            error_page 502 /502.html;

                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_cache_bypass $http_upgrade;

                proxy_pass http://0.0.0.0:8099;
                proxy_set_header Host guest8.ellak.org;
    }

    location = /502.html{
        root /var/www/ellak.org;
    }   
}

我希望通过别名 + 使用 SSL 来托管各种 docker 应用程序。但无论是访问http://guest8.ellak.gr/piwik或者http://guest8.ellak.org/mailcow我收到错误 404。

你能帮我找出原因吗?

相关内容