当我调用我的 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;
}
}
查看日志 - 没有任何内容 询问 chatgpt - 无能为力 谷歌 - 没有找到任何解决问题的方法
我认为这里的问题在于您指定了不正确的授权文件路径或使用了不正确的语法。试试这个:
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;
}
}