学习记录
Xampp使用Apache配置二级域名,apache怎么配置二级域名?
前提是在服务器供应商 ( 我的是阿里云 ) 将一级域名、二级域名都是用A解析解析在服务器上,可以ping通首先打开 / xampp / apache / conf / httpd.conf// 将下面这行文本注释去掉 注释是用 # 来注释的Include conf/extra/httpd-vhosts.conf然后打开 c / windows / system32 / drivers / etc / hosts 配置 host127.0.0.1 xxx.com # 一级域名127.
2020-08-19 05:13:20
196
                <blockquote> 

前提是在服务器供应商 ( 我的是阿里云 ) 将一级域名、二级域名都是用A解析解析在服务器上,可以ping通

首先打开 / xampp / apache / conf / httpd.conf

// 将下面这行文本注释去掉 注释是用 # 来注释的
Include conf/extra/httpd-vhosts.conf

然后打开 c / windows / system32 / drivers / etc / hosts 配置 host

127.0.0.1 xxx.com # 一级域名
127.0.0.1 a.xxx.com # 二级域名

最后一步就是配置二级域名指向路径

打开 / xampp / apache / conf / extra / httpd-vhosts.conf

注意:注释必须单独一行加,像如下注释肯定是不行的~~~~

# 跟配置一级域名一样
<VirtualHost *:80>
    ServerName xueshuai.top   # 你的一级域名
    DocumentRoot "C:\NewFile\web\xueshuai.top\dist"   # 一级域名指向路径 
    <Directory "C:\NewFile\web\xueshuai.top\dist">     
        Options FollowSymLinks IncludesNOEXEC Indexes
        DirectoryIndex index.html index.htm index.php
        AllowOverride all 
        Order Deny,Allow 
        Allow from all 
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName a.xueshuai.top # 你的二级域名
DocumentRoot "C:\NewFile\web\a.xueshuai.top\dist" # 二级域名指向路径
<Directory "C:\NewFile\web\a.xueshuai.top\dist">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>