微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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就可以看到效果了,

原文地址:https://www.jb51.cc/ubuntu/354427.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐