wamp apache无法在添加虚拟主机后访问文件夹

wamp apache无法在添加虚拟主机后访问文件夹,apache,virtualhost,wampserver,Apache,Virtualhost,Wampserver,我在c:\Windows\System32\drivers\etc\hosts中添加了 127.0.0.1 mysite.com 在httpd-vhosts.conf中 ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "c:/wamp/www/sf2/web/" ServerName mysite.com Should be first vhost so the the wamp menu page loads Also s

我在c:\Windows\System32\drivers\etc\hosts中添加了

127.0.0.1 mysite.com

  • 在httpd-vhosts.conf中

    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/wamp/www/sf2/web/"
    ServerName mysite.com
    
    Should be first vhost so the the wamp menu page loads
    Also should keep the security as this PC and internal network only
    
    <VirtualHost *:80>
        ServerAdmin webmaster@mysite.net
        DocumentRoot "C:/wamp/www"
        ServerName localhost
        ServerAlias localhost
        <Directory  "C:/wamp/www">
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1 192.168.0
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin webmaster@mysite.net
        DocumentRoot "C:/websrc/www/sf2/web"
        ServerName mysite.com
        ServerAlias www.mysite.com
        Options Indexes FollowSymLinks
        <Directory "D:/websrc/www/sf2/web">
            AllowOverride All
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1 192.168.0
        </Directory>
    </VirtualHost>
    
  • 在httpd.conf中,未注释“Include conf/extra/httpd vhosts.conf”

  • mysite.com正在运行,但现在我无法访问c:\wamp\www中的旧文件夹 有解决办法吗

    “localhost/somefolder”->打开“c:/wamp/www/somefolder”

    “mysite.com”->打开“c:/wamp/www/sf2/web/”


    同时?

    添加虚拟主机时,还必须为本地主机环境创建一个虚拟主机

    另外,最好在
    \wamp\www
    文件夹结构之外创建vhost。在本例中,我使用了
    C:\websrc\www
    。它确保每个站点的安全性不会与另一个站点混淆,并且如果您更改wamp,您不会意外地丢失站点代码

    所以在httpd-vhosts.conf中试试这个

    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "c:/wamp/www/sf2/web/"
    ServerName mysite.com
    
    Should be first vhost so the the wamp menu page loads
    Also should keep the security as this PC and internal network only
    
    <VirtualHost *:80>
        ServerAdmin webmaster@mysite.net
        DocumentRoot "C:/wamp/www"
        ServerName localhost
        ServerAlias localhost
        <Directory  "C:/wamp/www">
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1 192.168.0
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin webmaster@mysite.net
        DocumentRoot "C:/websrc/www/sf2/web"
        ServerName mysite.com
        ServerAlias www.mysite.com
        Options Indexes FollowSymLinks
        <Directory "D:/websrc/www/sf2/web">
            AllowOverride All
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.1 localhost ::1 192.168.0
        </Directory>
    </VirtualHost>
    
    应该是第一个vhost,以便加载wamp菜单页面
    还应保持安全,因为这台电脑和内部网络只
    服务器管理员webmaster@mysite.net
    DocumentRoot“C:/wamp/www”
    服务器名本地主机
    服务器别名本地主机
    命令拒绝,允许
    全盘否定
    允许来自127.0.0.1 localhost::1 192.168.0
    服务器管理员webmaster@mysite.net
    DocumentRoot“C:/websrc/www/sf2/web”
    服务器名mysite.com
    ServerAlias www.mysite.com
    选项索引跟随符号链接
    允许超越所有
    命令拒绝,允许
    全盘否定
    允许来自127.0.0.1 localhost::1 192.168.0