nginx | index.php是在access上下载的

问题描述 投票:0回答:1

当我调用我的 PHP 网站时,它会自动下载。我使用 Nginx 和 Debian 10、PHP 7.3-fpm

server {
    listen 443 ssl;
    server_name login.domain.de;
    root /var/www/html_domain/projek/login;
    ssl_certificate /etc/letsencrypt/live/domain.de/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/domain.de/privkey.pem;
    index index.html index.htm index.php;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ^~ /account/user2/ {
        auth_basic "user2";
        auth_basic_user_file /etc/nginx/login/.user2;
        try_files $uri $uri/ =404;
    }
    
    location ^~ /account/user/ {
        auth_basic "user";
        auth_basic_user_file /etc/nginx/login/.user;
        try_files $uri $uri/ =404; 
  }
}

on other code, its working

查看日志 - 没有任何内容 询问 chatgpt - 无能为力 谷歌 - 没有找到任何解决问题的方法

php nginx debian nginx-reverse-proxy nginx-location
1个回答
0
投票

我认为这里的问题在于您指定了不正确的授权文件路径或使用了不正确的语法。试试这个:

server {
    listen 443 ssl;
    server_name login.domain.de;
    root /var/www/html_domain/projek/login;
    ssl_certificate /etc/letsencrypt/live/domain.de/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/domain.de/privkey.pem;
    index index.html index.htm index.php;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /account/user2/ {
        auth_basic "user2";
        auth_basic_user_file /etc/nginx/login/.user2;
        try_files $uri $uri/ =404;
    }
    
    location ~ /account/user/ {
        auth_basic "user";
        auth_basic_user_file /etc/nginx/login/.user;
        try_files $uri $uri/ =404; 
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.