1
nginx 서버 아래에 심포니 앱이 있습니다. 기본 http 인증을 사용하지만/api/url 요청 내부의 모든 것을 제외하고 싶습니다.Nginx + Symfony. 서브 폴더를 제외한 기본 인증
이 내 현재의 구성이 nginx를위한 것입니다 : /etc/nginx/php-mysite.conf
에서
server {
listen 80;
listen [::]:80;
root /home/mysite/www/web;
index app.php index.php index.html;
server_name mysite.com;
error_log /home/mysite/logs/error.log warn;
access_log /home/mysite/logs/access.log;
location/{
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
include /etc/nginx/php-mysite.conf;
# Protect access
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location ~ ^/app\.php/api/(.*) {
include /etc/nginx/php-mysite.conf;
auth_basic "off";
}
location ~ /\.ht {
deny all;
}
}
는 PHP-FPM 구성입니다. 잘 작동한다.
모든 요청은 ^app.php(/|$)
위치 지정 문에 의해 처리되고있는 것으로 보입니다. /api/...
URL에 액세스 할 때 인증 요청을 사용하지 않도록 구성 할 수 없습니다.
나는 여러 시간 동안 성공하지 못했습니다.