我想将localhost服务器重命名为其他名称,但是我遇到了404错误。我已经按照如何设置它的步骤,但我仍然得到错误。我想知道出了什么问题。我将提供所做的更改。
C:\ Windows \ System32下\驱动程序\等\ hosts.file
127.0.0.1 localhost
127.0.0.1 bluescript.com.ph
::89 localhost
::89 bluescript.com.ph
C:\瓦帕\ BIN \阿帕奇\ apache2.4.9 \ CONF \额外\的httpd-vhost.conf 我在文件上添加了第三个主机
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName bluescript.com.ph
DocumentRoot "c:/wamp/www/bluescript/"
<Directory "c:/wamp/www/bluescript/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
在httpd.conf下我确实将我的端口更改为8989,因为skype将使用端口80
ServerName localhost:8989
#Listen 12.34.56.78:8989
Listen 0.0.0.0:8989
Listen [::0]:8989
我已经重新启动了WAMP并重新打开了Web浏览器并输入了url:http://bluescript.com.ph并收到错误:HTTP错误404.找不到请求的资源。我哪里出错?
答案 0 :(得分:0)
1)删除指向不存在的文件夹的虚拟(示例)虚拟主机
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
2) 如果必须为Apache使用非标准端口号,那么该端口号也需要在虚拟主机上。
您还应该为localhost添加虚拟主机
<VirtualHost *:8989>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:8989>
ServerName bluescript.com.ph
DocumentRoot "c:/wamp/www/bluescript/"
<Directory "c:/wamp/www/bluescript/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
另请注意从httpd.conf
删除评论以激活httpd - vhosts.conf
文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
现在重启Apache
当然,这意味着您必须在所有网址上使用非标准端口号。像
3) 这也是你的主机文件中的错误!此文件中未使用端口号,因此
::89 localhost
::89 bluescript.com.ph
应该是
::1 localhost
::1 bluescript.com.ph
此更改后重新启动,或从启动的命令窗口&#34; As Adminitrator&#34;做
net stop dnscache
net start dnscache