Experimental environment: centos7
Note: Because this experiment on the same server, the same as Apache and Nginx port 80, 60 so as to change the port Apache
1 Configure Nginx server:
Nginx edit the configuration file, writes the following
location ~ \.php$ {#所有以.php结尾的文件,前面\代表转义
proxy_pass http://本机IP:60;#本机IP与修改后的Apache端口
root cloud.com;#网站的根目录
index index.html index.htm;
}
Edit Apache file, modify the port number is 60
# vim /etc/httpd/conf/httpd.conf
Write a PHP file in the root directory of the httpd Web site
[root@cloud ~]# vim /var/www/html/
[root@cloud ~]# cd /var/www/html/
[root@cloud html]# ls
a.php
[root@cloud html]# cat a.php
apache test page
The results of the test (this machine configuration of Nginx service port 70):