簡體   English   中英

LEMP PHP-FPM無法在ubuntu 10.04白屏上與nginx一起使用

[英]LEMP PHP-FPM not working with nginx on ubuntu 10.04 White Screen

我已經用nginx服務器設置了LEMP。 我能夠顯示html頁面,但不能顯示PHP。 我只是收到一個錯誤,指出此頁面不可用或白色空白屏幕。 我正在嘗試在Ubuntu 10.04服務器上設置wordpress。 我仍然無法弄清楚PHP無法正常處理的情況。

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
root@ubuntu:/var/www/wordpress#

有誰知道可能是什么問題? 我無法測試php版本。 我嘗試清除並重新安裝,仍然沒有運氣。 我注意到/eth/php5/fpmwww.conf文件缺少pool.d文件夾。 有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

您也應該將此作為套接字運行,取消注釋這些行

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

並確保您有機會在這里安裝PHP fpm ini

/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;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM