For example, server A forwards A php request to server B.
Modify server A as follows
The code is as follows: |
Copy code |
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; } |
Change the ip address to the IP address of the PHP server.
The code is as follows: |
Copy code |
Location ~ . Php $ { Fastcgi_pass 192.168.4.3: 9000; Fastcgi_index index. php; Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; Include fastcgi_params; } |
The following table lists the configurations of the target server (server B, namely, the PHP Server)
First, enable server B's port modification and add a line to/etc/sysconfig/iptables.
The code is as follows: |
Copy code |
-A input-m state -- state NEW-m tcp-p tcp -- dport 9000-j ACCEPT |
Configure the php-fpm file
Yum is installed normally in/etc/php-fpm.d/www. conf, which is compiled and installed normally in/usr/local/php/etc/php-fpm.conf
The code is as follows: |
Copy code |
Modify: Listen = 127.0.0.1: 9000 Change Listen = 0.0.0.0: 9000 |
Modify
The code is as follows: |
Copy code |
Listen. allowed_clients = 127.0.0.1 Add allowed servers. In this example, two additional servers are added. Listen. allowed_clients = 127.0.0.1, 192.168.4.3, 192.168.4.127
|
You can also comment out the listen. allowed_clients configuration. By default, the listen. allowed_clients configuration allows connections from any machine without IP address restrictions.
Note: The nginx server and the php server should be deployed in the same directory. Otherwise, the File "File not found." will not be found in the 404 error ."