First, I installed Winginx in the system folder on my computer, very vain .. What I realized was quite late. Everything worked until I had to wield files on the server and had to move the server to another location. I deleted the entire WinGinx folder, turned on the installer, set it again in "C: \ Winginx".

I checked localhost, everything works, added a new project, threw files from the previous server, I get "504 Gateway Time-out". Long tormented with timeouts, put fastcgi_connect_timeout 10; , but it was 10 seconds of useless waiting, and before that I hadn’t even built anything to make the site work.

localhost / phpinfo.php works fine, but other projects do not run php files for some reason. On localhost, by default, there are no configs, I did not set anything. Any project will load all files except .php.

In the logs when connecting, I get the following error:

[notice] signal process started

[error] 16060 # 7760: * 17 upstream timed out (10060:) client: 127.0.0.1, server: my domain, request: "GET / HTTP / 1.1", upstream: "fastcgi: //127.0.0.1: 9000", host: "my domain"

What it is? The last time everything worked perfectly! Moreover, it says that problems with timeouts, this can not be. The site is not loaded, and last time I did not change the timeouts. Plus, I set the timeouts to 60s, which just delayed the wait until error 504.

I rummaged in the network on this topic, found information about php-fpm, but did not understand what it was and why, although many requested configs for it, and I don’t have them anywhere, I checked everything.

There is a line in nginx configs:

 fastcgi_pass localhost:9071; 

There is a similar line in the site configurations:

 fastcgi_pass 127.0.0.1:9000; 

When I looked at what ports are busy, I noticed that port 9000 is completely absent, and port 9071 is busy with the php-cgi.exe process. (although the default should be port 9000, but I did not change anything).

I use Winginx, Windows 10, nginx version 1.12.0, PHP Version 7.1.5. If you need any additional information - ask, I'm not sure what else to provide to resolve the issue.

Thank you for attention!


Site configs look like this, I haven't even changed them:

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

  • And what generally lives on port 9000? - Alexander Tolkachev
  • @Alexander T welcome! I with you, it seems, spoke in English. version of the site. I updated the question there with all the details and will update it a little later. At 9000 nothing lives, generally empty. But on 9071 there is php-cgi.exe, which is registered in fastcgi_pass in the main Nginx config. - Telion
  • Fun thing. Is it possible to show all nginx configs? - Alexander Tolkachev
  • one
    Well, I would suggest setting port 9071 in the site configuration and see what happens. In theory, if nothing is spinning on port 9000, then there should be a 502 error, but I could be wrong. - Alexander Tolkachev
  • one
    I propose to make a clean installation from scratch and immediately register port 9071. Well, you don’t have to do such things under Windows at all. You can install a virtual machine from Linux and do it there. - Alexander Tolkachev

4 answers 4

Based on the result of the discussion in the comments.

Very strange system behavior. I propose to rearrange nginx to zero and set it in the fastcgi_pass 127.0.0.1:9071 config instead of 127.0.0.1:9000 , since apparently the php handler hangs on port 9071, not 9000.

  • Ok, thanks again. I will wait until tomorrow and choose this as an answer if everything continues to work. - Telion
  • I understand that this is something off topic, but I still have one more problem with NGINX. When I send a request from a form to a verification page, the path to which is rewritten and looks like / formcheck, I get a 405 (Not Allowed) answer. Can you tell me which file is responsible for banning methods? There are no prohibitions in nginx.conf or konfah of the site, however, they are described above, if I don’t understand something ... - Telion
  • @Telion, if you have a new question, ask it, please, using the button “ ask a question ” in the right corner of the page - aleksandr barakin

Here you need to carefully look at the ports. 9071 is the 7PHP version, see which version is currently running, if 5.6, then the port will be 9056.

Another option, in C: \ Winginx \ php56 or php71 (depending on the version), open with php.ini notepad and uncomment extension = php_mysql.dll and extension = php_mysqli.dll. At the same time try to go to phpmyadmin on port 81, if PHP will swear at the absence of libmysql.dll - then download and upload to the system folder, do not forget to restart the entire assembly.

    It looks like this is the behavior in the extreme version of the Winginx configurator. If you create it through it, choose PHP by default, then port 9000 is set for fastcgi, and if you choose php 7.1, then port 9071 Actually, it is quite clever and convenient, but probably it would be worth informing users about this feature;)

    Although, in principle, all this can be seen in the settings: “Settings” -> “PHP versions” -> Listen (IP: port) = 127.0.0.1:9071

      The latest version of Winginx does not automatically install the php version. It is necessary to select "Server Config" in the project settings. In the left part go to the PHP section and select the desired version. settings