Lampp域名及二级域名配置方法

时间:2022-09-17 00:18:27

1、可以在apache的http.conf或httpd-vhosts.conf中配置,不过建议在httpd-vhosts.conf中配置

2、配置实例

<pre name="code" class="plain">#如果需要IP来访问服务,需配置这
<VirtualHost *:80> DocumentRoot /opt/apache/www ServerName 222.212.33.22</VirtualHost>

#主域名<VirtualHost *:80> #ServerAdmin webmaster@dummy-host.example.com DocumentRoot /opt/apache/www ServerName www.abc.cn #ErrorLog "logs/www.abc.cn-error_log" #CustomLog "logs/www.abc.cn-access_log" common
    #DirectoryIndex index.html index.htm index.php
</VirtualHost>
#二级域名<VirtualHost *:80>    #ServerAdmin webmaster@dummy-host.example.com    DocumentRoot /opt/apache/www/blog<pre name="code" class="plain">    ServerName  blog    ServerAlias blog.abc.cn  
#ErrorLog "logs/blog.abc.cn-error_log" #CustomLog "logs/blog.abc.cn-access_log" common
#DirectoryIndex index.html index.htm index.php
</VirtualHost>