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

来源:互联网 发布:超市积分软件 编辑:程序博客网 时间:2024/06/07 09:58

关于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.gzNameVirtualHost *:80NameVirtualHost *:8080NameVirtualHost *:8090Listen *:80Listen *:8080Listen *:8090<IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Window s XP. Listen 443</IfModule><IfModule mod_gnutls.c> Listen 443</IfModule>

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

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

<VirtualHost *:8090>DocumentRoot "/usr/www/demo"<Directory "/usr/www/demo">allow from allOptions +Indexes</Directory></VirtualHost>

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

0 0
原创粉丝点击