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

<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 all
Options +Indexes
</Directory>
</VirtualHost>

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dxmcu

谢谢鼓励!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值