Php 拉威尔+;基本身份验证,但有一个文件夹不工作
为了让nginx配置文件正常工作,我做了一些编码 我的目标是允许所有著名的文件夹和子文件夹与基本auth、limit_req和laravel兼容 let's Encrypt现在的问题是它没有更新证书,因为路由Php 拉威尔+;基本身份验证,但有一个文件夹不工作,php,laravel,nginx,Php,Laravel,Nginx,为了让nginx配置文件正常工作,我做了一些编码 我的目标是允许所有著名的文件夹和子文件夹与基本auth、limit_req和laravel兼容 let's Encrypt现在的问题是它没有更新证书,因为路由。著名的/acme challenge/wpczwan8mlhllsqwr7aszrj\u Tbk71g2Cd\u 1tPAv2JXM正在请求权限,可能受到位置~\.php$的影响 所以问题是:我能集成一个solo函数吗?比如~/和\.php$\(?!众所周知)。*如果是这样,我可以将两者的
。著名的/acme challenge/wpczwan8mlhllsqwr7aszrj\u Tbk71g2Cd\u 1tPAv2JXM
正在请求权限,可能受到位置~\.php$
的影响
所以问题是:我能集成一个solo函数吗?比如~/和\.php$\(?!众所周知)。*
如果是这样,我可以将两者的代码集成在一起吗
location ~ /\.(?!well-known).* {
limit_req zone=admin burst=5 nodelay;
limit_req_status 503;
try_files $uri $uri/ /index.php?$query_string;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
您可以尝试以下方法:
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
limit_req zone=admin burst=5 nodelay;
limit_req_status 503;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
}
location ^~ /.well-known/ {
allow all;
auth_basic off;
}
不确定是否可以通过轻松的方式进行优化
location / {
limit_req zone=admin burst=5 nodelay;
limit_req_status 503;
try_files $uri $uri/ /index.php?$query_string;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
}
location ^~ /.well-known/ {
auth_basic off;
}
我不认为它可以被优化但路线看起来不错。著名的/acme挑战/wpczwan8mlhllsqwr7aszrj_Tbk71g2Cd_1tPAv2JXM没有授权