The challenge is to raise 2 domains to Nginx . Of which one should work under php5 , and the other under php7 .


Server - Ubuntu Installed php5 and php7 on the server. Domains raised, a domain with php7 works great, and a domain under php5 displays an error:

502 bad gateway

I think the problem is in the include library of nginx, but I can not solve the problem.

I deduce a config of the 2nd domain on php5.

 server { listen 80; server_name test.am; # access_log /var/log/nginx/shopinamerica.access_log main; # error_log /var/log/nginx/shopinamerica.error_log info; root /var/www/test; # дирСктория имССтся index index.php; # Ρ„Π°ΠΉΠ» имССтся location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; # имССтся fastcgi_pass unix:/var/run/php5-fpm.sock; # имССтся } } 

Config check, not any errors, but does not work.

Here's also fastcgi_params:

  File: /etc/nginx/fastcgi_params fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_param HTTPS $https if_not_empty; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; 

I would be very grateful for the hint. Thank you in advance!

  • one
    And / etc / nginx / fastcgi_params show what you do not want? - MANKK
  • Corrected and added. - Alex Mixayelovich Sokolov
  • one
    you wrote about the socket file that it is "present". and who listens to him? you should have two fpm daemons running , one for each version of php. - aleksandr barakin
  • And how to run the second? - Alex Mixayelovich Sokolov
  • one
    @AlexMixayelovichSokolov: how was the first one launched? The same way. Something like service php5-fpm start . Do you have php5-fpm installed at all? - MANKK

0