在nginx上跑discuz,先修改配置文件php
cd /usr/local/nginx/conf/vhosts/
vim test.conf
server { listen 80; server_name www.test.com; index index.html index.htm index.php; root /data/www; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/www.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name; } }
/usr/local/nginx/sbin/nginx -t
/etc/init.d/nginx reload
在瀏覽器輸入 www.test.com 錯誤502html
查看nginx的錯誤日誌,錯誤日誌的位置在主配置文件裏面nginx
vim ../nginx.conf
搜索 /error error_log /usr/local/nginx/logs/nginx_error.log crit; 級別是critvim
查看錯誤日誌瀏覽器
cat /usr/local/nginx/logs/nginx_error.log
ll /tmp/www.sock
srw-rw---- 1 root root 0 12月 31 01:23 /tmp/www.sock 由於做爲其餘人,沒有讀的權限,因此502php-fpm
vim /usr/local/php/etc/php-fpm.conf
[www] listen = /tmp/www.sock user = php-fpm group = php-fpm 改成 [www] listen = /tmp/www.sock user = php-fpm group = php-fpm listen.owner = nobody listen.group = nobody
/usr/local/php/sbin/php-fpm -t
/etc/init.d/php-fpm restart
刷新 沒有問題spa