我正在尝试为新的ubuntu / php5.5 / nginx安装设置虚拟主机
等/ nginx的/ sites_available / mydomain.com:
server {
listen 80 default_server;
root /home/www/mydomain.com/public/;
index index.php index.html
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server_name mydomain.com;
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 240;
include /etc/nginx/fastcgi_params;
}
}
等/主机:
127.0.0.1 mydomain.com
在“sites-enabled”文件夹中的符号链接中的符号链接:
sudo ln -s /etc/nginx/sites-available/mydomain.com /etc/nginx/sites-enabled/mydomain.com
service nginx restart
失败,var / log / nginx / error.log给出
no port in upstream "php5-fpm-sock" in /etc/nginx/sites-enabled/mydomain.com:12
什么可能是错的?
答案 0 :(得分:4)
缺少fpm地址路径:
nano /etc/nginx/conf.d/php5-fpm.conf
编辑:
upstream php5-fpm-sock {
server unix:/var/run/php5-fpm.sock;
}
答案 1 :(得分:3)
您缺少php-fpm路径设置。
fastcgi_pass php5-fpm-sock;
你还没有指向php-fpm来听。将其改为。
fastcgi_pass 127.0.0.1:9000;
或
fastcgi_pass unix:/var/run/php5-fpm.sock;