[英]New SubDomain Config for Nginx Throwing an Error: [crit] 29036#0
I have (1) domain and two paths configured: mysite.com blog.mysite.com 我有(1)个域和两个配置的路径:mysite.com blog.mysite.com
I'm trying to configure a wordpress
blog on my existing mysite.com
nginx server, 我正在尝试在现有的
mysite.com
nginx服务器上配置wordpress
博客,
mysite.com has a sites-enabled
config of: mysite.com具有
sites-enabled
了sites-enabled
配置:
server {
listen 80;
server_name *.mysite.com;
root /home/ubuntu/virtualenv/mysite/mysite/myapp/;
access_log /home/ubuntu/virtualenv/mysite/error/access.log;
error_log /home/ubuntu/virtualenv/mysite/error/error.log warn;
connection_pool_size 2048;
fastcgi_buffer_size 4K;
fastcgi_buffers 64 4k;
location /static {
alias /home/ubuntu/virtualenv/mysite/mysite/myapp/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 10;
proxy_connect_timeout 10;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
blog.mysite.com has a sites-enabled
config of: blog.mysite.com具有
sites-enabled
配置,该配置包括:
server {
listen 80;
server_name blog.mysite.com;
root /home/ubuntu/virtualenv/blog;
index index.php;
#### errors
access_log /home/ubuntu/virtualenv/blog/error/access.log;
error_log /home/ubuntu/virtualenv/blog/error/error.log warn;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
fastcgi_buffer_size 4K;
fastcgi_buffers 64 4k;
#### locations
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
the error.log
file in blog.mysite.com
is showing an error of: blog.mysite.com
的error.log
文件显示以下错误:
2014/01/02 02:50:05 [crit] 29036#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: xx.xxx.xx.xxx, server: blog.mysite.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "blog.mysite.com"
Anyone know why this isn't working? 有人知道为什么这行不通吗? I tried some research, but can't seem to find the solution.
我尝试了一些研究,但似乎找不到解决方案。
Thank you! 谢谢!
If anyone run's into this error when trying to add a subdomain or domain while configuring nginx with phpfm - follow the steps in this post: https://askubuntu.com/questions/114076/ubuntu-php5-fpm-unix-socket 如果有人在使用phpfm配置nginx时尝试添加子域或域时遇到此错误-请按照本文中的步骤操作: https ://askubuntu.com/questions/114076/ubuntu-php5-fpm-unix-socket
The gist: sudo vim /etc/php5/fpm/pool.d/www.conf. 要点:sudo vim /etc/php5/fpm/pool.d/www.conf。
Look for the line listen = 127.0.0.1:9000 and change it to something like listen = /var/run/php5-fpm.sock. 查找行listen = 127.0.0.1:9000并将其更改为listen = /var/run/php5-fpm.sock之类的内容。 After doing so, restart PHP FPM:
这样做之后,重新启动PHP FPM:
sudo /etc/init.d/php5-fpm restart 须藤/etc/init.d/php5-fpm重新启动
Hope this helps someone :) 希望这可以帮助某人:)
Actually it's not really related to subdomains, you just didn't use the right configuration, your fpm was listening to a port instead of a sock file, it wouldn't have worked even without the subdomain, 实际上,它与子域并没有真正的关系,您只是没有使用正确的配置,您的fpm监听的是端口而不是sock文件,即使没有子域也无法正常工作,
your main site was working because it was passing to port 8001 您的主站点正在工作,因为它正在传递到端口8001
proxy_pass http://127.0.0.1:8001;
Your subdomain could have worked if you passed to port 9000 如果您传递到端口9000,则您的子域可能已经正常工作
proxy_pass http://127.0.0.1:9000;
But the way you fixed it is better, using sock files is better than port. 但是,解决问题的方法更好,使用sock文件比使用port更好。
Just wanted to explain that it wasn't because of the subdomain. 只是想解释一下,这不是因为子域。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.