- 配置监听
/etc/httpd/conf/httpd.conf 中:Listen 80 处添加Listen 8088(端口号) - 配置虚拟域名(apache)
创建/etc/httpd/conf.d/httpd-vhost.conf文件
<VirtualHost *:8088>
#虚拟域名
ServerName a.com
#入口文件位置
DocumentRoot /var/www/html/XXX/public
#根目录访问权限配置
<Directory "/var/www/html/XXX/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
- 注册虚拟域名访问地址
编辑/etc/hosts文件
添加127.0.0.1 a.com (a.com为虚拟域名,与上述ServerName保持一致)后保存文件, - 重启apache服务器
Systemctl restart httpd - 浏览器访问
服务器IP地址: http://IP:8088/index.php
注意:需要开启服务器安全组配置中的端口号