简体   繁体   English

nginx没有通过FastCGI运行.php

[英]nginx not running .php through FastCGI

What am I doing wrong here? 我在这里做错了什么? My config is as follows: 我的配置如下:

server {
listen        80;
server_name   internal.lan;

access_log /var/log/nginx/int-access.log;
error_log  /var/log/nginx/int-error.log;
root       /var/www/int;

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}

I've checked that the socket exists at the path in question, but any PHP files just get presented as plain text. 我已经检查过套接字在相关路径中是否存在,但是所有PHP文件都只是以纯文本形式显示。

Probably a very simple one as I've never configured PHP with a server besides Apache before; 可能是非常简单的一个,因为我以前从未使用Apache以外的服务器配置PHP; can anyone help? 有人可以帮忙吗? Thanks. 谢谢。

Ah we had problems like this a dozen of times. 啊,我们遇到过这样的问题十几次了。 The solution was for us to put php and nginx under the same user group. 解决方案是让我们将php和nginx放在同一用户组下。

Short tags were the problem. 短标签是问题所在。

<? to <?php fixed this. <?php修复了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM