在/etc/apache2中
打开:ports.conf
在Listen 80
下面添加多个监听端口如
Listen 8011
Listen 8088
这样就增加了8011和8088端口的监听
在 /apache2/sites-available/000-default.conf中
<VirtualHost *:80>ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:8011>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:8088>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
重启Apache服务,即可以用
localhost
localhost:8011
localhost:8088
访问你不同的网站了
本文介绍如何在Apache服务器上配置多个监听端口,通过修改ports.conf文件添加新的监听端口,并在000-default.conf中设置对应的VirtualHost。完成配置后重启Apache服务即可实现通过不同端口访问各自的网站。
1071

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



