WampServer环境下虚拟主机配置

开启虚拟主机

1.先打开apache的配置文件httpd.conf ,找到
#Include conf/extra/httpd-vhosts.conf
把#去掉就开启虚拟主机了。

2虚拟主机配置:

#配置自己的虚拟主机
<VirtualHost *:80>
    #网站目录,如果在www目录下的php目录,下面就填写F:/www/phpp
    DocumentRoot “F:/www” 
    #域名
    ServerName localhost
    #这里配置欢迎首页面
    DirectoryIndex index.html index.htm index.php
    <Directory />
    Options FollowSymLinks Indexes
    #不允许别人修改我们的页面
    AllowOverride None
    #设置访问权限
    order allow,deny
    Allow from all
    </Directory>   

</VirtualHost>

———————————————————-

#原来默认的目录
<VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot “D:/wamp/www”
</VirtualHost>

#配置自己的虚拟主机
<VirtualHost *:80>
    #访问域名
    ServerName 127.0.0.3
    #网站目录例如:F:/www/phpp
    DocumentRoot “D:/webroot” 
    #这里配置欢迎首页面
    DirectoryIndex index.html index.htm index.php
    <Directory />
        Options FollowSymLinks  Indexes
        #不允许别人修改我们的页面
        AllowOverride None
        #设置访问权限
        order allow,deny
        Allow from all
    </Directory>   
</VirtualHost>

#这个是新增的努力目录
<VirtualHost *:80>
    #域名
    ServerName 127.0.0.2
    #域名2
    ServerAlias 
    #网站目录 例如:DocumentRoot “D:/webroot” 
    DocumentRoot “D:/webroot/wx”
    #目录相关权限
    <Directory “D:/webroot/wx”>
        #浏览权限
        Options FollowSymLinks IncludesNOEXEC Indexes
        #默认文件名
        DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.shtml index.aspx default.aspx  
        #不允许别人修改我们的页面
        AllowOverride None
        #设置访问权限
        Order Deny,Allow
        Allow from all
        #允许访问其他目录
        #php_admin_value open_basedir “D:/webroot/wordpress/;D:/APMServ5.2.6/tmp/uploadtemp/;D:\APMServ5.2.6\tmp\sessiondata”
        php_admin_value safe_mode On
    </Directory>
</VirtualHost>

#-------------------------------------------------
<VirtualHost *:80>
	ServerName 127.0.0.1
	ServerAlias 
	ServerAdmin webmaster@dummy-host.localhost
	DocumentRoot "Z:/cjjs_201705"

	<Directory "Z:/cjjs_201705" >
	    Options Indexes FollowSymLinks
	    AllowOverride all
	    Order Deny,Allow
	    Require all granted
	</Directory>
	
</VirtualHost>

#-------------------------------------------------
#Z:\cs.jingsai.la
#-------------------------------------------------

<Directory "Z:/" >
	Options Indexes FollowSymLinks
	AllowOverride all
	Order Deny,Allow
	Require all granted
</Directory>

<VirtualHost *:80>
	ServerName 127.9.9.1
	ServerAlias 
	ServerAdmin webmaster@dummy-host.localhost
	DocumentRoot "Z:/cs.jingsai.la/127.9.9.1"
</VirtualHost>

发表评论

邮箱地址不会被公开。 必填项已用*标注