我可以在wamp 3中将项目名称命名为hello_world

时间:2017-04-04 10:06:04

标签: apache wamp

我使用了wamp 2并且现在安装了wamp 3,在wamp 2项目名称就像hello_world但是在wamp 3中得到错误。我在主机文件中添加了虚拟主机,如 - 的httpd-hosts.conf

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.88.32:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.88.32:3001
 --------------------------------------
[BS] Serving files from: .tmp/
[12:00:30] Starting 'clean:styles'...
[12:00:30] Starting 'clean:markup'...
[12:00:30] Finished 'clean:markup' after 3.12 ms
[12:00:30] Starting 'pug'...
[12:00:30] Finished 'clean:styles' after 8.61 ms
[12:00:30] Starting 'sass'...
[BS] Reloading Browsers...
[BS] 1 file changed (index.html)
[12:00:30] Finished 'pug' after 72 ms
[BS] 1 file changed (main.css)
[12:00:30] Finished 'sass' after 144 ms
[12:00:30] Starting 'inject:styles'...
[12:00:30] gulp-inject 1 files into index.html.
[12:00:30] Finished 'inject:styles' after 9.67 ms
[12:00:30] Starting 'inject'...
[12:00:30] Finished 'inject' after 2.99 μs
[12:00:30] Starting 'styles'...
[12:00:30] Finished 'styles' after 2.47 μs

C:\ Windows \ System32下\驱动程序\等\主机

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/hello_world"
    ServerName project1
    <Directory  "c:/wamp/www/hello_world">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

为什么我收到错误?请帮忙。

1 个答案:

答案 0 :(得分:1)

您的ServerNameproject1

ServerName project1

因此,您的HOSTS文件需要为此域定义IP

HOSTS文件

127.0.0.1 localhost
::1 localhost

127.0.0.1 project1
::1 project1

另外不要忘记你在hosts文件中也需要localhost

更改后,您需要重新启动dnscache。

(right click) wampmanager-> Tools-> Restart DNS

替代地

更改ServerName,但不要使用域名中的_字符,它无效。尝试用-

替换它
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/hello-world"
    ## change the domain name
    ServerName hello_world

    <Directory  "c:/wamp/www/hello-world">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>