【发布时间】:2014-09-27 19:08:16
【问题描述】:
我使用的是 Ubuntu 13,并且我已经安装了 nginx 和 php5-fpm;在此之前我安装了 PHP5 和 apache;我删除了
/etc/php5/fpm/pool.d/www.conf
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
nginx 配置文件:
upstream php {
server unix:/var/run/php5-fpm.socket;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
当我尝试时
它下载 info.php 文件而不是执行该文件
但是当我尝试时:
它显示了phpinfo() 函数
问题出在哪里?
【问题讨论】:
-
我会说你有2台具有相同根的服务器,尝试将
local.host添加到server_name并重新加载nginx,看看它是否仍然发生