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

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...