Ubuntu 12.10 安装nginx后报502错误

来源:互联网 发布:新手如何快速入门seo 编辑:程序博客网 时间:2024/05/21 23:34

首先来让我们看看之前得配置。关于PHP一块的配置。

  1. location ~ \.php$ {
  2. try_files $uri =404;
  3. fastcgi_pass 127.0.0.1:9000;
  4. fastcgi_index index.php;
  5. include fastcgi_params;
  6. }

问题其实出现在 fastcgi_pass得配置上面。
在ubuntu 12.10安装了php5-fpm之后。我们可以去

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

里面找到这样一条代码:

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

这个是使用unix得方式来使用php5-fpm得。
这个时候。我们得php配置要改成

  1. location ~ \.php$ {
  2. fastcgi_pass unix:/var/run/php5-fpm.sock;
  3. fastcgi_index index.php;
  4. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  5. include fastcgi_params;
  6. }

这里fastcgi_pass的地址要改成这个。。这样你的lnmp就正常了。

原创粉丝点击