Nginx提供504个网关超时,一旦移动到现场

我打算把我的网站(drupal 6.25)从apache切换到nginx。 我已经为nginx准备了一切,并在端口81上进行了testing。它工作正常。 现在我改变了听从81到80,并停止Apache,并启动Nginx。 网站开始给予


504网关超时 nginx的/ 0.8.54

并没有提供任何服务:(我的nginx服务器是

服务器{
        听80积分= 128;
         root / var / www / web1 / htdocs;
         index index.php index.html index.htm;        
         server_name www.example.com;

        位置 / {
        如果(!-e $ request_filename){
                重写^ /(。*)$ /index.php?q=$1 last;
                 }
         }

         access_log /var/log/nginx.web1.log;
         error_log /var/log/nginx.web1.error.log错误;
        位置〜* ^。+ \。(jpg | jpeg | gif | css | png | js | ico)$ {
                重写^ / favicon.ico $ /sites/all/themes/sky/favicon.ico break;
                 access_logclosures;
                到期30天;
         }
        位置〜\ .php $ {
        包括/ etc / nginx / fastcgi_params;
         #fastcgi_pass 127.0.0.1:9000; 我也尝试过这个选项
         fastcgi_pass unix:/tmp/php.socket;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME / var / www / web1 / htdocs / $ fastcgi_script_name;
     }
 }

和nginx.conf包含:


用户www-data;
 worker_processes 5;
 pid /var/run/nginx.pid;

事件{
         worker_connections 64;
         #multi_accept on;
 }

 http {

         ##
         # 基本设置
         ##

        发送文件;
         tcp_nopush;
         tcp_nodelay;
         keepalive_timeout 65;
         keepalive_requests 20;
         types_hash_max_size 2048;
         #server_tokens off;

         #server_names_hash_bucket_size 64;
         #server_name_in_redirect off;

        包括/etc/nginx/mime.types;
         default_type application / octet-stream;

         ##
         #logging设置
         ##

         access_log /var/log/nginx/access.log;
         error_log /var/log/nginx/error.log;

         ##
         #Gzip设置
         ##

         gzip on;
         gzip_static on;
         gzip_disable“msie6”;

         #gzip_vary on;
         #gzip_proxied any;
         #gzip_comp_level 6;
         #gzip_buffers 16 8k;
         #gzip_http_version 1.1;
         #gzip_types text / plain text / css application / json application / x-javascript text / xml application / xml application / xml + rss text / javascript;

         ##
         #虚拟主机configuration
         ##

 包括/etc/nginx/conf.d/*.conf;
         include / etc / nginx / sites-enabled / *;
 }


 #mail {
 ##请参阅示例authentication脚本:
 ##http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
 #
 ##auth_http localhost / auth.php;
 ##pop3_capabilities“TOP”“USER”;
 ##imap_capabilities“IMAP4rev1”“UIDPLUS”;
 #
 #服务器{
 #listen localhost:110;
 #协议pop3;
 #代理上;
 #}
 #
 #服务器{
 #listen localhost:143;
 #协议的imap;
 #代理上;
 #}
 #}

有什么错误的想法? 或者我该如何解决?
非常感谢你的帮助

你正试图连接到unix:/tmp/php.socket上的PHP Fast-CGI unix:/tmp/php.socket ,但是你没有运行PHP Fast-CGI守护进程。 PHP-FPM是一个单独的守护进程 ,nginx 不会自动产生它。

查看有关部署FastCGI Process Manager(FPM)和HOWTO以在Ubuntu上安装Nginix + PHP-FPM的 PHP文档

如果您使用的是标准安装,则很可能会有一个名为php-fpmphp5-fpm ,您应该启动它并将其添加到自动启动的服务列表中。