2014-09-10 3 views
0

자신의 빌드 nginx를 작동하지 않습니다 여기의 nginx-PHP 내가이 구성 명령의 nginx를 컴파일

#user nobody; 
worker_processes 1; 

#error_log logs/error.log; 
#error_log logs/error.log notice; 
#error_log logs/error.log info; 

#pid  logs/nginx.pid; 


events { 
    worker_connections 1024; 
} 


http { 
    include  mime.types; 
    default_type application/octet-stream; 

    #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; 

    sendfile  on; 
    #tcp_nopush  on; 

    #keepalive_timeout 0; 
    keepalive_timeout 65; 

    #gzip on; 

    server { 
     listen  80; 
     #server_name localhost; 

     #charset koi8-r; 

     #access_log logs/host.access.log main; 

     location/{ 
      root html; 
      index index.html index.htm; 
     } 

     #error_page 404    /404.html; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html { 
      root html; 
     } 

    location ~* \.php$ { 
     root html; 
      fastcgi_index index.php; 
      #fastcgi_pass 127.0.0.1:9000; 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
     include   fastcgi_params; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      fastcgi_param SCRIPT_NAME  $fastcgi_script_name; 
    } 

     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 
     # 
     #location ~ \.php$ { 
     # proxy_pass http://127.0.0.1; 
     #} 

     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
     # 
     #location ~ \.php$ { 
     # root   html; 
     # fastcgi_pass 127.0.0.1:9000; 
     # fastcgi_index index.php; 
     # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
     # include  fastcgi_params; 
     #} 

     # deny access to .htaccess files, if Apache's document root 
     # concurs with nginx's one 
     # 
     #location ~ /\.ht { 
     # deny all; 
     #} 
    } 


    # another virtual host using mix of IP-, name-, and port-based configuration 
    # 
    #server { 
    # listen  8000; 
    # listen  somename:8080; 
    # server_name somename alias another.alias; 

    # location/{ 
    #  root html; 
    #  index index.html index.htm; 
    # } 
    #} 


    # HTTPS server 
    # 
    #server { 
    # listen  443; 
    # server_name localhost; 

    # ssl     on; 
    # ssl_certificate  cert.pem; 
    # ssl_certificate_key cert.key; 

    # ssl_session_timeout 5m; 

    # ssl_protocols SSLv2 SSLv3 TLSv1; 
    # ssl_ciphers HIGH:!aNULL:!MD5; 
    # ssl_prefer_server_ciphers on; 

    # location/{ 
    #  root html; 
    #  index index.html index.htm; 
    # } 
    #} 

} 

rtmp { 
     server { 
       listen 1935; 
       chunk_size 4096; 

       application live { 
         live on; 
         record off; 
       } 
     } 
} 

그리고 오류 로그 출력 : 내가

여기

내 nginx.conf 파일입니다 (나는 PHP-FPM 설치 한) :(페이지를 열려고하면 파일, 그것은 나에게 오류를 제공합니다 :

2014/09/10 15:52:16 [notice] 22803#0: signal process started 
2014/09/10 15:52:39 [notice] 22808#0: signal process started 
2014/09/10 15:57:21 [notice] 22819#0: signal process started 
2014/09/10 16:02:15 [error] 22891#0: *1 connect() failed (111: Connection refused) while c$ 
2014/09/10 16:03:36 [crit] 22947#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13$ 
2014/09/10 16:05:41 [crit] 23002#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (13$ 
2014/09/10 16:06:26 [crit] 23057#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13$ 
2014/09/10 16:06:26 [crit] 23057#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13$ 
2014/09/10 16:06:27 [crit] 23057#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13$ 

권한이없는 것처럼 보이지만 어떻게 nginx에 권한을 부여 할 수 있습니까?

답변

0

청취자 지시어로 잘못된 부분 오류가 발생했습니다. nginx 및 php-fpm에 대해 동일해야합니다. nginx.conf에서 socket을 사용한다면, php-fpm pool conf에 socket을 사용해야합니다 (예 : debian은 /etc/php5/fpm/pool.d/www.conf)

nginx.conf) 이미 설정 :

fastcgi_pass unix:/var/run/php5-fpm.sock; 

PHP-FPM www.conf :. 데비안

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

이러한 설정이 도움이되지 않을 경우들을 설정하려고 * nginx에하기의 사용자 (예 : www가 데이터)

php-fpm www.conf :

listen.owner = www-data 
listen.group = www-data 
+0

안녕하세요 저는 여러분이 제안한 것이 효과가 없었기 때문에 다른 방법을 발견했습니다. 설정 : fastcgi_pass 127.0.0.1:9000; 다음 www.conf i set 듣기 : 수신 대기 = 127.0.0.1:9000 이제 완벽하게 작동합니다. – user2663781

+0

당신은 소켓에 대해 질문했습니다. 항상 고마워 할 수 있습니다;) 소켓은 기본 nix 방식 (그리고 더 빠름)이지만 때때로 더 많은 설정이 필요합니다. IP : 포트 표기법은 처음에는 괜찮습니다. 문제가 해결되어서 다행입니다. –