lnmp常见的502错误解决
1、拷贝配置文件cd /usr/local/nginx/conf/vhosts/
cp default.conf test.conf
2、修改以下配置
将
server
{
listen 80 ;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
allow all;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
修改为
server
{
listen 80 ;
server_name www.test.com;
index index.html index.htm index.php;
root /data/www;
allow all;
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/tmp/www.sock;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
}
3、修改php-fpm文件
vim /usr/local/php/etc/php-fpm.conf
将默认文件修改成以下
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
listen = /tmp/www.sock
user = php-fpm
group = php-fpm
listen.owner = nobody
listen.group = nobody
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
slowlog = /tmp/www_slow.log
request_slowlog_timeout =1
php_admin_value=/data/www:/tmp/
页:
[1]