红人网事 |
Posted: 19 Nov 2012 10:54 PM PST 进入apache安装目录 编辑conf目录下的httpd.conf文件: 找到 # Virtual hosts # Include conf/extra/httpd-vhosts.conf 把Include conf/extra/httpd-vhosts.conf前面的#去掉,进入conf\extra\目录 编辑httpd-vhosts.conf文件 NameVirtualHost *:80 #www.abc.com <VirtualHost *:80> ServerAdmin abc.com@gmail.com DocumentRoot "C:/Program Files/WebServ/www/abc.com" ServerName abc.com ServerAlias www.abc.com ErrorLog "logs/www.abc.com-error.log" CustomLog "logs/www.abc.com-access.log" common </VirtualHost> #root.123.com <VirtualHost *:80> #email address ServerAdmin abc.com@gmail.com #webpath DocumentRoot "C:/Program Files/WebServ/www/root" #url ServerName root.123.com #error log ErrorLog "logs/root.123.com-error.log" #request log CustomLog "logs/root.123.com-access.log" common </VirtualHost> 这是我的配置,改成你自己的就行了。 你要是想为某个虚拟主机开启rewrite功能或者访问限制,在 </VirtualHost>前面加上 <Directory "虚拟主机path"> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> 根据需要来修改设置,并重启apache 如果在服务器上不需要以下步骤,直接把域名指向服务器IP就可以了。 ———————————————————————————————————————— 最后别忘了本地解析一下 C:\WINDOWS\system32\drivers\etc目录下的 hosts文件,用文本编辑器打开,加入以下内容: 127.0.0.1 www.abc.com 127.0.0.1 root.123.com save之后就可以用www.abc.com 和 root.123.com访问你的web目录了。 |
You are subscribed to email updates from OnTheRoad To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |