내 nginx 서버에서 starnge 문제가 발생했습니다. 404
오류가 발생했지만 html 파일이 제대로 작동하는 하위 폴더 아래에 php 파일이 있습니다.PHP에서 Nginx : 하위 디렉토리에 던져진 404 오류
폴더 구조
html<folder>
index.php
test<folder>
test.php //not working
test.html //works fine
Nginx의 구성
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/html;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}ml
액세스 <ip-address>/test/test.html
는
액세스 <ip-address>/test/test.php
404 오류가 잘 작동한다.
액세스가 <ip-address>
일 때 잘 동작합니다 (html/index.php
파일을 가리킴).
html 폴더에 권한을 추가했으며, php.ini 파일에서 cgi.fix_pathinfo=0
도 사용할 수 있습니다.
아마도 https://serverfault.com/에 더 적합 할 수 있습니다. – jhmckimm