nginx| index.php在access上下载

col17t5w  于 12个月前  发布在  Nginx
关注(0)|答案(1)|浏览(118)

当我调用我的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 -不能帮助谷歌-没有找到任何解决问题的方法

xj3cbfub

xj3cbfub1#

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

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; 
  }
}

字符串

相关问题