文章转自:https://blog.csdn.net/weixin_43945743/article/details/84927318
nginx使用80端口 apache使用8080端口
nginx的安装 apache的安装 PHP的安装跳过
一、配置nginx
配置文件:/etc/nginx/sites-enabled/default
server {
listen 80;
server_name test.com;
root /var/www/html;
index index.nginx-debian.html index.htm index.php;
location ~ \.php$ {
proxy_pass http://127.0.0.1:8080; #apache服务端口
}
}
二、配置apache
配置文件:/etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Llsten 80 -----改成------> Listen 8080
三、测试
在/var/www/html下创建php测试文件
vi /var/www/html/index.php
写入
<?php
phpinfo();
?>
重启nginx和apache
$ /usr/sbin/nginx -s reload
$ /etc/init.d/apache2 restart
打开浏览器输入:test.com/index.php即可看到php信息页面
2444

被折叠的 条评论
为什么被折叠?



