RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 675063
Accepted
Telion
Telion
Asked:2020-06-04 18:10:58 +0000 UTC2020-06-04 18:10:58 +0000 UTC 2020-06-04 18:10:58 +0000 UTC

504 网关超时 Winginx

  • 772

首先,我在计算机的系统文件夹中安装了 Winginx,非常徒劳..我很晚才意识到这一点。一切正常,直到我不得不在服务器上使用文件并将服务器移动到另一个位置。删除整个 WinGinx 文件夹,启用安装程序,在“C:\Winginx”中重新安装它。

我检查了本地主机,一切正常,添加了一个新项目,将文件从以前的服务器扔到那里,我得到“504 网关超时”。我忍受了很长时间的超时,设置fastcgi_connect_timeout 10;了它,但那是 10 秒的无用等待,在那之前我什至没有添加任何东西来使网站正常工作。

localhost/phpinfo.php 工作正常,但其他项目由于某种原因不运行 php 文件。默认情况下,localhost 没有自己的配置,我没有设置任何东西。任何项目都由除 .php 之外的所有文件加载。

连接时我在日志中收到以下错误:

[notice] 信号进程开始

[error] 16060#7760: *17 upstream timed out (10060: A connection attempt failed because the connected party didn't properly response after a period time, or established connection failed because connected host has failed respond) 连接上游时,客户端:127.0.0.1,服务器:我的域,请求:“GET/HTTP/1.1”,上游:“fastcgi://127.0.0.1:9000”,主机:“我的域”

这是什么?上次一切都很好!而且,他说超时没有问题,这不可能。该站点未加载任何内容,上次我没有更改超时。另外,我将超时设置为 60 秒,这只是将等待时间拖到了 504 错误。

我在网上翻遍了这个主题,找到了有关 php-fpm 的信息,但我仍然不明白它是什么以及为什么,虽然很多人要求为此配置,但我没有任何地方,我查了一下一切。

nginx 配置中有一行:

fastcgi_pass localhost:9071;

站点配置中有类似的行:

fastcgi_pass 127.0.0.1:9000;

当我查看哪些端口在忙什么时,我注意到 9000 端口根本没有,而 9071 端口被 php-cgi.exe 进程占用了。(虽然默认应该是 9000 端口,我也没有改什么)。

我正在使用 Winginx,Windows 10,nginx 版本 1.12.0,PHP 版本 7.1.5。如果您需要任何其他信息 - 请询问,我不确定还应该提供什么来解决问题。

感谢您的关注!


站点配置如下所示,我什至没有更改它们:

server {
	listen 127.0.0.1:80;
	server_name music-portfolio.com www.music-portfolio.com;

	root home/music-portfolio.com/public_html/;

	index index.php index.html;

	log_not_found off;
	access_log logs/music-portfolio.com-access.log;

	charset utf-8;

	location ~ /\. { deny all; }
	location = /favicon.ico { }
	location = /robots.txt { }

	location ~ \.php$ {
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
		include fastcgi_params;
	}
	


}

nginx.conf:

#user  nobody;
worker_processes  1;

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

pid        temp/nginx.pid;


events {
    worker_connections  1024;
}


http {
	server_names_hash_bucket_size 128;

    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;

    client_max_body_size 55m;

    #gzip  on;

	scgi_temp_path  temp/uwsgi_temp 1 2;
	uwsgi_temp_path  temp/uwsgi_temp 1 2;

	fastcgi_connect_timeout 1;


	server {
		listen   127.0.0.1:80;

		root home/localhost/public_html;
		index index.php index.html;

		log_not_found off;
        charset utf-8;

		access_log  logs/access.log  main;

		location ~ /\. {deny all;}

		location / {

			if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
				root home/$2/public_html;
				access_log  logs/$2-access.log  main;
			}

		}

        location ~ \.php$ {

			if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
				root home/$2/public_html;
				access_log  logs/$2-access.log  main;
			}

			if (!-e $document_root$document_uri){return 404;}
			fastcgi_pass localhost:9071;
			fastcgi_index index.php;
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

			include fastcgi_params;

        }
	}

	server {
		listen 127.0.0.1:443;
		include ssl.conf;

		root home/localhost/public_html;
		index index.php index.html;

		log_not_found off;
        charset utf-8;

		access_log  logs/access.log  main;

		location ~ /\. {deny all;}

		location / {

			if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
				root home/$2/public_html;
				access_log  logs/$2-access.log  main;
			}

		}

        location ~ \.php$ {

			if ($host ~ ^(www\.)?([a-z0-9\-\.]+)$){
				root home/$2/public_html;
				access_log  logs/$2-access.log  main;
			}

			if (!-e $document_root$document_uri){return 404;}
			fastcgi_pass localhost:9071;
			fastcgi_index index.php;
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

			include fastcgi_params;

        }
	}


	include tools-*.conf;

	include vhosts/*.conf;

}

nginx
  • 4 4 个回答
  • 10 Views

4 个回答

  • Voted
  1. Best Answer
    Alexander Tolkachev
    2020-06-07T04:21:41Z2020-06-07T04:21:41Z

    作为评论中讨论的结果。

    系统的非常奇怪的行为。我建议将它重新排列为零nginx并在配置中设置它fastcgi_pass 127.0.0.1:9071而不是127.0.0.1:9000. 显然 php 处理程序挂在端口 9071,而不是 9000。

    • 1
  2. dr_dos
    2020-06-25T05:16:56Z2020-06-25T05:16:56Z

    这里需要仔细查看端口。9071是7PHP的版本,看现在运行的是哪个版本,如果是5.6那么端口就是9056。

    另一种选择,在 C:\Winginx\php56 或 php71(取决于版本)中,用记事本打开 php.ini 并取消注释 extension=php_mysql.dll 和 extension=php_mysqli.dll。同时,尝试访问 phpmyadmin 的 81 端口,如果 PHP 抱怨缺少 libmysql.dll,则下载并放到系统文件夹中,不要忘记重新启动整个程序集。

    • 1
  3. bigvax
    2020-02-24T12:10:52Z2020-02-24T12:10:52Z

    这似乎是最新版本的 Winginx 配置器中的行为。如果通过它创建域时,默认选择PHP,那么9000端口分配给fastcgi,如果选择php 7.1,那么9071端口其实很机智和方便,但可能值得通知用户这一点特征;)

    虽然原则上,所有这些都可以在设置中看到:“设置”->“PHP 版本”-> 监听(IP:端口)= 127.0.0.1:9071

    • 0
  4. Петро Сагайдачний
    2020-12-12T01:39:45Z2020-12-12T01:39:45Z

    最新版本的Winginx不会自动安装php版本。您需要在项目设置中选择“Server Config”。在左侧,转到 PHP 部分并选择所需的版本。 设置

    • 0

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    Python 3.6 - 安装 MySQL (Windows)

    • 1 个回答
  • Marko Smith

    C++ 编写程序“计算单个岛屿”。填充一个二维数组 12x12 0 和 1

    • 2 个回答
  • Marko Smith

    返回指针的函数

    • 1 个回答
  • Marko Smith

    我使用 django 管理面板添加图像,但它没有显示

    • 1 个回答
  • Marko Smith

    这些条目是什么意思,它们的完整等效项是什么样的

    • 2 个回答
  • Marko Smith

    浏览器仍然缓存文件数据

    • 1 个回答
  • Marko Smith

    在 Excel VBA 中激活工作表的问题

    • 3 个回答
  • Marko Smith

    为什么内置类型中包含复数而小数不包含?

    • 2 个回答
  • Marko Smith

    获得唯一途径

    • 3 个回答
  • Marko Smith

    告诉我一个像幻灯片一样创建滚动的库

    • 1 个回答
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Алексей Шиманский 如何以及通过什么方式来查找 Javascript 代码中的错误? 2020-08-03 00:21:37 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    user207618 Codegolf——组合选择算法的实现 2020-10-23 18:46:29 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5