Hello.
There are two hosts. At first I installed nginx, I request index.html - it returns, everything works.
I installed php on the second host (using sudo apt-get install php-fpm php-mysql).
Nginx code:
server { listen 443; ssl on; ssl_certificate /etc/ssl/xxxx.com.crt; ssl_certificate_key /etc/ssl/xxxx.com.key; root /var/www/xxxx.com/html; index index.html index.htm index.nginx-debian.html; server_name xxxx.com www.xxxx.com; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass xxx.xxx.xxx.xx:9000; #ip второго хоста на котором установлен php #include fastcgi_params; #fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param QUERY_STRING $query_string; } } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name xxxx.com www.xxxx.com; return 301 https://xxxx.com; } In the /etc/php/7.0/fpm/pool.d/www.conf file on the second host, replace the line listen = /run/php/php7.0-fpm.sock with listen = XXX.XXX.XXX.XX: 9000 ( where X is the Ip of the same host). I also tried to write listen = 127.0.0.1:9000.
In the folder with the site on the first host I add the Index.php file in it, displaying the string Hello World. However, the page does not open and gives 504 error after about 30 seconds.
Ping both hosts from each other normally. What can be wrong? Thank.
$ telnet XXX.XXX.XXX.XX 9000. ru.stackoverflow.com/q/541021/178576 - aleksandr barakin