我试图在Fedora 20盒子上用PHP-FPM设置NGINX, 只有当启动php-fpm作为系统服务时,我才得到“File not found / Primary script unknown”错误。
我在默认的fastcgi.conf中使用了NGINX的默认设置。
(使用: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; )
这里是相关的nginx.conf:
root /var/www/index; index index.html index.php index.htm; location ~ \.php$ { try_files $uri = 404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi.conf; }
现在,当我直接从shell(以root身份)启动php-fpm时,一切正常,但是当我使用systemctl start php-fpm.service fpm systemctl start php-fpm.service我得到“文件未find/主脚本未知”错误。
这里是php-fpm.service的定义:
[Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=notify PIDFile=/run/php-fpm/php-fpm.pid EnvironmentFile=/etc/sysconfig/php-fpm ExecStart=/usr/sbin/php-fpm --nodaemonize ExecReload=/bin/kill -USR2 $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
有没有人有一个想法,为什么php-fpm可以通过systemd启动不同的行为? (我很困惑,尤其是因为php-fpm产生工作进程,从shell启动到systemd启动之间不应该有任何区别)。
我没有在fpm池configuration中使用任何chroot或chdir设置。
任何帮助将不胜感激! 谢谢Marcus