Xampp使用Apache配置二级域名,apache怎么配置二级域名?
前提是在服务器供应商 ( 我的是阿里云 ) 将一级域名、二级域名都是用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>
博主信息:
昵称: | XCoder
网站: | 我的网站
邮箱: | xueshuai_12@163.com
QQ: | 246776020
QQ群: | 1063233592
WeChat: | js_cool_100