【发布时间】:2018-08-25 13:30:03
【问题描述】:
我做了一些编码来让 nginx 配置文件正常工作。
我的目标是允许所有 .well-known 文件夹和子文件夹保留其余的基本身份验证、limit_req 和 laravel 兼容。
现在 let's Encrypt 的问题是它没有更新证书,因为路由 .well-known/acme-challenge/wPCZZWAN8mlHLSQWr7ASZrJ_Tbk71g2Cd_1tPAv2JXM 正在请求许可,可能受到 location ~ \.php$ 的影响
所以问题是:我可以集成一个独奏功能吗?比如~ / and \.php$ \.(?!well-known).*如果是这样,我可以将两者的代码整合在一起吗?
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;
}
【问题讨论】: