![](/img/trans.png)
[英]vhosts or hosts file issue - going to localhost 'homepage' (using WAMPServer)
[英]Wampserver - The ServerName localhost:7979 is not defined into hosts file
這是配置文件 - C:\wamp64\bin\apache\apache2.4.51\conf\extra\httpd-vhosts.conf
# Virtual Hosts
#
'''
<VirtualHost *:7979>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
主機文件 - C:\Windows\System32\drivers\etc
127.0.0.1 localhost
::1 localhost
我可以訪問我的項目很好,它只是在主頁上它帶來了這個錯誤。
在您的主機文件 - C:\Windows\System32\drivers\etc 中,您可以添加或編輯您的第一行:
127.0.0.1 localhost:7979
有一個向 WAMPServer 添加端口號的過程。
使用系統托盤中的 wampmanager.exe 圖標執行以下操作
Right click wampmanager icon -> Tools -> Add a Listen port to Apache
這將在屏幕上彈出一個小對話框,輸入您要使用的端口號,然后將其添加到httpd.conf
文件中,如下所示
Define MYPORT8082 8082
進入httpd.conf
文件的這一部分
像這樣
Define APACHE24 Apache2.4
Define VERSION_APACHE 2.4.52
Define INSTALL_DIR c:/wamp64
Define APACHE_DIR ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}
Define MYPORT8082 8082
Define SRVROOT ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}
如果您像這樣添加端口號,則更改httpd-vhosts.conf
文件以使用 VirtualHosts 定義上的定義
<VirtualHost *:${MYPORT8082}>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.