2
특정 디렉토리 (html/test)의 .html 파일에 nginx 읽기 PHP 코드를 포함시킬 수 없습니다. CentOS 6을 실행하고 FastCGI를 설치했습니다. 몇 가지 구성을 시도했지만 아무 일도하지 않습니다. 내 nginx.conf은 다음과 같습니다 : 나는 같은 일을하려고했다와 서버가 .PHP 확장자가없는 스크립트 "403 금지"반환NGINX - PHP로 html 파일 매핑
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
server_name www.domain.com;
rewrite ^(.*) http://domain.com$1 permanent;
}
server {
listen 80;
server_name shop-munk.com *.shop-munk.com;
location/{
root /opt/html;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /opt/html;
}
location ~ \.php$ {
root opt/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.html$ {
root opt/html/test;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME /$fastcgi_script_name;
include fastcgi_params;
}
}
}