服务器配置多个域名管理多个空间

虚拟主机配置

在一台web服务器上,我们可以通过配置虚拟主机,然后分别设定根目录,实现对多个网站的管理。

具体步骤如下:

1.找到http.conf文件

找到470行,去掉#号注释

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2.找到httpd-vhosts.conf文件

在目录:D:\phpStudy\Apache\conf\extra下找到httpd-vhosts.conf文件

# 默认的虚拟主机
<VirtualHost _default_:80>
  DocumentRoot "C:\www\study"
  <Directory "C:\www\study">
    Options +Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

# Add any other Virtual Hosts below
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    #根目录
    DocumentRoot "C:\www\show"
    #域名
    ServerName show.com
    #完整域名
    ServerAlias www.show.com
    ErrorLog "logs/dummy-host.example.com-error.log"
    CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>   
posted @ 2021-04-03 23:08  镜像山海  阅读(123)  评论(0)    收藏  举报