nginx 错误 connect() to unix:/var/run/php5-fpm.sock failed

开源中国技术顾问 发布于 2015/06/09 16:49
阅读 15K+
收藏 0
nginx配置文件如下
#user  nobody;
worker_processes  8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;


error_log  /var/log/nginx/error.log crit; 


worker_rlimit_nofile 204800;


pid        nginx.pid;






events {
    use epoll;
    worker_connections  204800;
}
http { include mime.types; default_type application/octet-stream; charset utf-8; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; access_log off; ignore_invalid_headers on; server_names_hash_bucket_size 128; client_body_buffer_size 16K; client_header_buffer_size 1k; client_max_body_size 1024m; large_client_header_buffers 4 8k; client_body_timeout 10; client_header_timeout 10; keepalive_timeout 5 5; send_timeout 10; limit_conn_zone $binary_remote_addr zone=addr:10m; limit_conn_zone $server_name zone=perserver:10m; #limit_conn addr 10; sendfile on; tcp_nopush on; open_file_cache max=204800 inactive=20s; open_file_cache_min_uses 1; open_file_cache_valid 30s; tcp_nodelay on; gzip on; gzip_proxied any; gzip_min_length 1k; gzip_types text/plain application/javascript application/x-javascript text/css application/xml application/json image/png image/jpeg image/gif; gzip_vary on; gzip_http_version 1.0; gzip_comp_level 2; proxy_connect_timeout 60; proxy_read_timeout 60; proxy_send_timeout 60; proxy_buffer_size 128k; proxy_buffers 8 128k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k; userid on; userid_name uid; userid_domain .leyikao.net; userid_path "/; HttpOnly"; userid_expires 1d; userid_p3p 'policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR STA NID"'; #fastcgi_cache_path /usr/local/nginx/fastcgi_cache levels=1:2 keys_zone=TEST:10m inactive=5m; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; server { listen 80; # [改] 网站的域名 server_name edusoho-dev.com www.edusoho-dev.com; # [改] 程序的安装路径 root /var/www/edusoho/web; # [改] 日志路径 access_log /var/log/nginx/example.com.access.log; error_log /var/log/nginx/example.com.error.log; location / { index app.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } location ~ ^/udisk { internal; # [改] 请根据程序的实际安装路径修改。该目录下存放的是私有的文件课时的视频、音频等。 root /var/www/edusoho/app/data/; } location ~ ^/(app|app_dev)\.php(/|$) { # [改] 请根据实际php-fpm运行的方式修改 fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect; # [改] 请根据程序的实际安装路径修改。该目录下存放的是私有的文件。 fastcgi_param HTTP_X-Accel-Mapping /udisk=/var/www/edusoho/app/data/udisk; fastcgi_buffer_size 128k; fastcgi_buffers 8 128k; } # 配置设置图片格式文件 location ~* \.(jpg|jpeg|gif|png|ico|swf)$ { # 过期时间为3年 expires 3y; # 关闭日志记录 access_log off; # 关闭gzip压缩,减少CPU消耗,因为图片的压缩率不高。 gzip off; } # 配置css/js文件 location ~* \.(css|js)$ { access_log off; expires 3y; } # 禁止用户上传目录下所有.php文件的访问,提高安全性 location ~ ^/files/.*\.(php|php5)$ { deny all; } # 以下配置允许运行.php的程序,方便于其他第三方系统的集成。 location ~ \.php$ { # [改] 请根据实际php-fpm运行的方式修改 fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; } } }


出现错误: connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.1.17, server: edusoho-dev.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "edusoho-dev.com"

我已经设置了

listen.owner = www-data

listen.group = www-data

listen.mode = 0660

求教

加载中
0
micheal_ll
micheal_ll

/etc/php5/fpm/pool.d/www.conf

里面找到这样一段代码:

listen = 127.0.0.1:9000 

在这上面代码的下面添加一行:

listen = /var/run/php5-fpm.sock

保存后启动php5-fpm

/etc/init.d/php5-fpm restart

这时就可以正常访问了

0
dreamhack
dreamhack
啊哈,居然看到我写的东西被贴出来了
返回顶部
顶部