4. 重启 Apache 服务.
5.在hosts中绑定域名 127.0.0.1 demo.index.com
6.测试:在浏览器中 demo.index.com 一般默认访问的是index.html,如果网站文件存放的根目录没有index.html 会报404错误,如果你想访问其他的文件直接在后面追加文件路径就可以啦。
7.如果发现不能访问,请查看httpd.conf 将Deny from all 注掉就哦了。具体可查看http://imvoo.com/archives/407.html
Options FollowSymLinks
AllowOverride None
Order deny,allow
#Deny from all
关于Linux环境,摘自网络 后继学习~
Redhat Enterprise Linux
Redhat Enterprise Linux (包括 CentOS Linux), 是使用最广的 Linux 服务器, 大量的网站应用都部署在其上.
1. 打开文件 /etc/httpd/conf/httpd.conf, 搜索 VirtualHost example, 找到代码如下:
# # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # # # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #