Ubuntu下nginx与php配置

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

在网页上面的报错

不太清楚原因是什么

鑫强
浏览 4578回答 4
4回答

mooc用户18273

启动php-fpm方法错误,不用start,直接php-fpmnetstat -lntup |grep php-fpm 看启动没有

鑫强

2016/01/24 18:05:22 [emerg] 10789#0: directive "location" has no opening "{" in /usr/local/nginx/conf/nginx.conf:652016/01/24 18:06:51 [error] 10818#0: *1 open() "/usr/local/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"2016/01/24 18:06:55 [error] 10818#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:40:03 [error] 10818#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:40:03 [error] 10818#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:40:04 [error] 10818#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:30 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:48 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:48 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:49 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:49 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:49 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:49 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:49 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:42:53 [error] 10818#0: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"2016/01/24 18:56:28 [error] 10818#0: *22 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /one.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"这是nginx 的错误文件这是php-fpm的启动后的提示root@g98051815-X201E:/usr/local/php/sbin# sudo ./php-fpm startUsage: php-fpm [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F [-O]]  -c <path>|<file> Look for php.ini file in this directory  -n               No php.ini file will be used  -d foo[=bar]     Define INI entry foo with value 'bar'  -e               Generate extended information for debugger/profiler  -h               This help  -i               PHP information  -m               Show compiled in modules  -v               Version number  -p, --prefix <dir>                   Specify alternative prefix path to FastCGI process manager (default: /usr/local/php).  -g, --pid <file>                   Specify the PID file location.  -y, --fpm-config <file>                   Specify alternative path to FastCGI process manager config file.  -t, --test       Test FPM configuration and exit  -D, --daemonize  force to run in background, and ignore daemonize option from config file  -F, --nodaemonize                   force to stay in foreground, and ignore daemonize option from config file  -O, --force-stderr                   force output to stderr in nodaemonize even if stderr is not a TTY  -R, --allow-to-run-as-root                   Allow pool to run as root (disabled by default)这是不是表示php-fpm启动没有成功?

wuzzxx

把你现在的配置贴出来,同时看看错误日志。根据错误找到解决方法。如果你网站用到FastCGI 可能是因为 FastCGI没运行的原因。

柒朩

如果你是系统管理员,那么你应该检查错误日志的详细信息!
打开App,查看更多内容
随时随地看视频慕课网APP