2016-02-09 20 views
0

我已經用nginx服務器設置了LEMP。我能夠顯示html頁面,但不能顯示PHP。我只是得到一個錯誤,表明這個頁面不可用或白色的空白屏幕。我正在嘗試在Ubuntu 10.04服務器上設置wordpress。我仍然無法弄清楚什麼是交易與PHP不工作。LEMP PHP-FPM不能在ubuntu 10.04上與nginx一起使用白色屏幕

nginx的配置

server { 
      listen 80; 
      server_name localhost; 

      root /var/www/wordpress; 
      index index.php index.html index.htm; 

      location/{ 
       try_files $uri $uri/ /index.php?q=$uri&$args; 
      } 

      error_page 404 /404.html; 
      error_page 500 502 503 504 /50x.html; 

      location = /50x.html { 
       root /var/www/nginx-default;  #/usr/share/nginx/html; 
      } 

      location ~ \.php$ { 
       #try_files $uri =404; 
       #fastcgi_split_path_info ^(.+\.php)(/.+)$; 
       #fastcgi_pass unix:/var/run/php5-fpm.sock; 
       #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       #fastcgi_index index.php; 
       #include fastcgi_params; 
       fastcgi_split_path_info ^(.+\.php)(/.+)$; 
       fastcgi_pass 127.0.0.1:9000; 
       fastcgi_index index.php; 
       include fastcgi_params; 
       } 
} 

php5-fpm.log 
Feb 08 14:04:01.380712 [NOTICE] fpm is running, pid 3146 
Feb 08 14:04:01.387353 [NOTICE] ready to handle connections 
Feb 08 14:38:43.340483 [NOTICE] Finishing ... 
Feb 08 14:38:43.344984 [NOTICE] exiting, bye-bye! 
Feb 08 14:38:44.388290 [NOTICE] fpm is running, pid 3334 
Feb 08 14:38:44.391049 [NOTICE] ready to handle connections 
Feb 08 15:03:57.966383 [NOTICE] Finishing ... 
Feb 08 15:03:57.971061 [NOTICE] exiting, bye-bye! 
Feb 08 15:03:59.014873 [NOTICE] fpm is running, pid 3474 
Feb 08 15:03:59.018001 [NOTICE] ready to handle connections 
Feb 08 15:08:16.355286 [NOTICE] Finishing ... 
Feb 08 15:08:16.359873 [NOTICE] exiting, bye-bye! 
Feb 08 15:08:17.403145 [NOTICE] fpm is running, pid 3525 
Feb 08 15:08:17.406341 [NOTICE] ready to handle connections 
Feb 08 15:10:25.265253 [NOTICE] Finishing ... 
Feb 08 15:10:25.268715 [NOTICE] exiting, bye-bye! 
Feb 08 15:10:26.311067 [NOTICE] fpm is running, pid 3570 
Feb 08 15:10:26.322278 [NOTICE] ready to handle connections 
Feb 08 15:31:43.851963 [NOTICE] Finishing ... 
Feb 08 15:31:43.856204 [NOTICE] exiting, bye-bye! 
Feb 08 15:31:44.902028 [NOTICE] fpm is running, pid 3776 
Feb 08 15:31:44.908454 [NOTICE] ready to handle connections 
Feb 08 15:50:06.496222 [NOTICE] Reloading in progress ... 
Feb 08 15:50:06.500402 [NOTICE] reloading: execvp("/usr/bin/php5-fpm", {"/usr/bin/php5-fpm", "--fpm-config", "/etc/php5/fpm/php5-fpm.conf"}) 
Feb 08 15:50:06.561997 [NOTICE] using inherited socket fd=6, "127.0.0.1:9000" 
Feb 08 15:50:06.562221 [NOTICE] fpm is running, pid 4057 
Feb 08 15:50:06.564898 [NOTICE] ready to handle connections 
Feb 08 15:51:53.775527 [NOTICE] Finishing ... 
Feb 08 15:51:53.778933 [NOTICE] exiting, bye-bye! 
Feb 08 15:51:54.822645 [NOTICE] fpm is running, pid 4095 
Feb 08 15:51:54.827625 [NOTICE] ready to handle connections 

nginx error.log 
2016/02/08 14:01:02 [error] 1433#0: *1 open() "/var/www/nginx-default/favicon.ico" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "10.129.3.198", referrer: "http://10.129.3.198/" 
2016/02/08 14:17:43 [crit] 3233#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:17:43 [error] 3233#0: *1 open() "/var/www/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:04 [crit] 3233#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:04 [error] 3233#0: *1 open() "/var/www/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:05 [crit] 3233#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:05 [error] 3233#0: *1 open() "/var/www/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:41 [crit] 3233#0: *7 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:18:41 [error] 3233#0: *7 open() "/var/www/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: cloud59.net, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:36:36 [warn] 3302#0: conflicting server name "cloud59.net" on 0.0.0.0:80, ignored 
2016/02/08 14:36:36 [warn] 3303#0: conflicting server name "cloud59.net" on 0.0.0.0:80, ignored 
2016/02/08 14:38:56 [crit] 3323#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:38:56 [error] 3323#0: *2 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:46:31 [crit] 3382#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /index.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:46:31 [error] 3382#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /index.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:46:52 [crit] 3382#0: *4 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:46:52 [error] 3382#0: *4 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:49:38 [crit] 3402#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:49:38 [error] 3402#0: *1 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:55:07 [crit] 3439#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:55:07 [error] 3439#0: *2 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:56:46 [crit] 3439#0: *4 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 14:56:46 [error] 3439#0: *4 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:04:01 [crit] 3439#0: *7 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:04:01 [error] 3439#0: *7 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:04:02 [crit] 3439#0: *7 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:04:02 [error] 3439#0: *7 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:08:21 [crit] 3514#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:08:31 [crit] 3514#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:10:31 [crit] 3559#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /index.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:11:05 [crit] 3559#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:11:07 [crit] 3559#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:11:11 [crit] 3559#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 15:11:47 [crit] 3559#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198", referrer: "http://10.129.3.198/readme.html" 
2016/02/08 15:29:20 [crit] 3559#0: *12 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 

權限:

drwxr-xr-x 5 www-data www-data 4096 2016-02-08 15:35 . 
drwxr-xr-x 4 root  root  4096 2016-02-08 14:55 .. 
-rw-r--r-- 1 www-data www-data 397 2008-05-25 13:33 index.php 
-rw-r--r-- 1 root  root  20 2016-02-08 15:35 info.php 
-rw-r--r-- 1 www-data www-data 15410 2008-12-05 23:47 license.txt 
-rw-r--r-- 1 www-data www-data 9127 2010-04-03 22:57 readme.html 
-rw-r--r-- 1 www-data www-data 4391 2010-04-19 05:01 wp-activate.php 
drwxr-xr-x 7 www-data www-data 4096 2010-06-17 09:05 wp-admin 
-rw-r--r-- 1 www-data www-data 40265 2010-05-26 10:27 wp-app.php 
-rw-r--r-- 1 www-data www-data 220 2008-10-13 23:22 wp-atom.php 
-rw-r--r-- 1 www-data www-data 274 2008-05-25 08:50 wp-blog-header.php 
-rw-r--r-- 1 www-data www-data 3926 2010-05-06 08:38 wp-comments-post.php 
-rw-r--r-- 1 www-data www-data 238 2008-10-13 23:22 wp-commentsrss2.php 
-rw-r--r-- 1 www-data www-data 3173 2010-05-25 16:47 wp-config-sample.php 
drwxr-xr-x 4 www-data www-data 4096 2010-06-17 09:05 wp-content 
-rw-r--r-- 1 www-data www-data 1255 2010-03-16 21:39 wp-cron.php 
-rw-r--r-- 1 www-data www-data 240 2010-04-19 05:03 wp-feed.php 
drwxr-xr-x 7 www-data www-data 4096 2010-06-17 09:05 wp-includes 
-rw-r--r-- 1 www-data www-data 2002 2010-03-18 01:39 wp-links-opml.php 
-rw-r--r-- 1 www-data www-data 2441 2010-02-28 04:19 wp-load.php 
-rw-r--r-- 1 www-data www-data 26059 2010-06-01 08:54 wp-login.php 
-rw-r--r-- 1 www-data www-data 7774 2010-05-25 19:42 wp-mail.php 
-rw-r--r-- 1 www-data www-data 487 2009-04-20 14:50 wp-pass.php 
-rw-r--r-- 1 www-data www-data 218 2008-10-13 23:22 wp-rdf.php 
-rw-r--r-- 1 www-data www-data 316 2008-05-25 08:50 wp-register.php 
-rw-r--r-- 1 www-data www-data 220 2008-10-13 23:22 wp-rss2.php 
-rw-r--r-- 1 www-data www-data 218 2008-10-13 23:22 wp-rss.php 
-rw-r--r-- 1 www-data www-data 9177 2010-05-02 15:18 wp-settings.php 
-rw-r--r-- 1 www-data www-data 18685 2010-06-11 13:19 wp-signup.php 
-rw-r--r-- 1 www-data www-data 3702 2010-02-24 12:13 wp-trackback.php 
-rw-r--r-- 1 www-data www-data 93955 2010-05-03 15:16 xmlrpc.php 
[email protected]:/var/www/wordpress# 

有誰知道這個問題可能是什麼?我無法測試PHP版本。我嘗試清除並重新安裝,仍然沒有運氣。我注意到pool.d文件夾丟失,/eth/php5/fpm中的www.conf文件丟失。有php5- fpm.conf文件,不知道天氣與我失蹤的www.conf相同。如果有人能找到解決問題的辦法,那會很好。

編輯: 從推薦的調整錯誤日誌的其他錯誤:

nginx error.log 
2016/02/08 15:11:47 [crit] 3559#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198", referrer: "http://10.129.3.198/readme.html" 
2016/02/08 15:29:20 [crit] 3559#0: *12 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198" 
2016/02/08 18:15:19 [emerg] 4490#0: "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:27 
2016/02/08 18:33:49 [emerg] 4538#0: "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:26 
2016/02/08 18:35:30 [crit] 4548#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 10.129.3.105, server: localhost, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "10.129.3.198", referrer: "http://10.129.3.198/readme.html" 
2016/02/08 18:44:08 [emerg] 4642#0: "default_server" parameter can be specified for the default "listen" directive only in /etc/nginx/sites-enabled/default:3 

php5-fpm.log 
Feb 08 15:50:06.500402 [NOTICE] reloading: execvp("/usr/bin/php5-fpm", {"/usr/bin/php5-fpm", "--fpm-config", "/etc/php5/fpm/php5-fpm.conf"}) 
Feb 08 15:50:06.561997 [NOTICE] using inherited socket fd=6, "127.0.0.1:9000" 
Feb 08 15:50:06.562221 [NOTICE] fpm is running, pid 4057 
Feb 08 15:50:06.564898 [NOTICE] ready to handle connections 
Feb 08 15:51:53.775527 [NOTICE] Finishing ... 
Feb 08 15:51:53.778933 [NOTICE] exiting, bye-bye! 
Feb 08 15:51:54.822645 [NOTICE] fpm is running, pid 4095 
Feb 08 15:51:54.827625 [NOTICE] ready to handle connections 
Feb 08 18:35:11.335243 [NOTICE] Finishing ... 
Feb 08 18:35:11.340091 [NOTICE] exiting, bye-bye! 
Feb 08 18:35:12.384908 [NOTICE] fpm is running, pid 4571 
Feb 08 18:35:12.387789 [NOTICE] ready to handle connections 
Feb 08 18:43:55.545583 [NOTICE] Finishing ... 
Feb 08 18:43:55.549643 [NOTICE] exiting, bye-bye! 
Feb 08 18:43:56.594919 [NOTICE] fpm is running, pid 4624 
Feb 08 18:43:56.597689 [NOTICE] ready to handle connections 
+0

當您取消註釋這兩行時會發生什麼情況:'#fastcgi_pass unix:/var/run/php5-fpm.sock; #fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;'? – Darren

+0

@達倫我嘗試了對這些評論,仍然得到「您正在尋找的頁面暫時無法使用,請稍後再試。」任何想法可能是什麼? – Dmitriy

+0

我注意到您的網站是不聽,試着在你的'服務器的開頭添加此{'標籤:'聽80 default_server; 聽[:]:80 default_server ipv6only =上;' – Darren

回答

0

你應該和運行這是一個插座,取消這些線路

#fastcgi_pass unix:/var/run/php5-fpm.sock; 
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

,並確保你有機會php fpm ini here

/etc/php5/fpm/php.ini 

並確保它讀取像

cgi.fix_pathinfo=0 

重新啓動nginx和php-fpm服務。

這裏是這裏我的Ubuntu的nginx的conf>的例子

服務器{ 聽80;

root /usr/share/nginx/html/wph; 
    index index.php index.html index.htm; 

    server_name example.com; 
    charset utf-8; 

    fastcgi_buffers 16 16k; 
    fastcgi_buffer_size 32k; 


    location ~ \.php$ { 
      try_files $uri =404; 
      fastcgi_split_path_info ^(.+\.php)(/.+)$; 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      include fastcgi_params; 
    } 
    location/{ 

      try_files $uri $uri/ /index.php?$args; 

    } 
    include /usr/share/nginx/html/wph/nginx.conf; 
} 

server { 
    listen 80; 
    server_name www.example.com; 
    return 301 http://example.com$request_uri; 
} 
+0

我已經檢查了這些選項,我仍然得到然而」您正在查找的頁面暫時不可用 請再試一次後來。」 我不確定還有什麼不對。 – Dmitriy

+0

你試圖在localhost上運行這個嗎? – user1669039

+0

同時粘貼你/var/log/nginx/error.log這裏的最後幾項。可能還會發布一些你的php-fpm錯誤,所以我們可以把它全部修復。 – user1669039