ubuntu安装集成lamp环境后如何配置多站点

关于ubuntu下lamp环境的配置,在ubuntu下如何配置lamp环境一文中,笔者提到了如何配置,但是没有说明如何配置多站点,导致了好多人都问笔者,这里,刚好今天有时间,就发布出来了,

首先,进入apache的配置文件,

 /etc/apache2/

目录下,然后打开ports.conf

PS:因为笔者是在虚拟机下进行的测试,所以配置的是不同端口的,如果是在服务器上测试,就不需要处理这一步了,直接跳过

# 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
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
NameVirtualHost *:8080
NameVirtualHost *:8090
Listen *:80
Listen *:8080
Listen *:8090


 # If you add NameVirtualHost *:443 here, you will also have to change
 # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
 # to 
 # Server Name Indication for SSL named virtual hosts is currently not
 # supported by MSIE on Window s XP.
 Listen 443



 Listen 443


添加你需要的端口,然后保存,在打开httpd.conf配置文件,

这个是一个空白的文件,然后添加如下代码:


DocumentRoot "/usr/www/demo"

allow from all
Options +Indexes


然后重启apache,然后在浏览器中输入http://localhost:8090就可以看到效果了,

你可能感兴趣的:(Linux服务器)