简体   繁体   中英

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.

Probably a very simple one as I've never configured PHP with a server besides Apache before; 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.

Short tags were the problem.

<? to <?php fixed this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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