내 nginx를 설정했지만 가상 호스트의 모든 * .php 파일에 500 개의 내부 서버 오류가 반환됩니다.nginx 및 apache (php)
server {
listen tucnak.dev:80; ## listen for ipv4; this line is default and implied
root /home/tucnak/Web/Lab;
index index.php index.html;
server_name tucnak.dev;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
proxy_pass http://127.0.0.1;
}
location ~ \.php$ {
set $php_root /home/tucnak/Web/Lab;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
어디에서 오류가 있습니까? 내 PHP 파일이 정확합니다!
<?php echo("Hello!"); ?>
저는 정말 nginx에서 새로운 기능으로 도움이 필요합니다. apache2 이후 - 혼란스러워!
UPD : nginx가 성공적으로 아파치에 대한 쿼리를 제공하지 않는다고 생각합니다. 나는 그것을 고치는 법을 모른다.
왜 'proxy_pass'와 'fastcgi_pass'를 모두 사용하고 있습니까? – Rifat
그 (proxy_pass)없이 그는 .php 파일을 다운로드 할 것을 제안합니다.) – tucnak
~ 위치 중 하나를 제거해야 할 수도 있습니다 ~ \ .php $ 그것은 분명하지 않습니다, 당신은 아파치 백엔드 또는 fastcgi를 사용하고 있습니다. nginx 나는 그것을 해결할 수 없다고 생각합니다 – ykhrustalev