简体   繁体   中英

Apache virtual host on different ports doesn't work

I'm trying to serve different folders on my localhost. I'm using Windows OS.

I want to serve E:/Programming/Projects on localhost:8080 , and E:/htdocs on localhost:80

My httpd-vhosts.conf file is like that:

Listen 8080
<VirtualHost *:8080>
    ServerName localhost
    DocumentRoot "E:/Programming/Projects"
    <Directory "E:/Programming/Projects">
        AllowOverride All
    </Directory>

</VirtualHost>

When I attempt to navigate localhost:80, this port works well. But localhost:8080 gives this error:

403 - Forbidden
You don't have permission to access this resource.

I've reset my server, but it doesn't work.

The correct answer is:

Listen 8080

<VirtualHost *:8080>
    ServerName localhost:8080
    DocumentRoot "E:/Programming/Projects/"
    <Directory "E:/Programming/Projects/">
        Options +Indexes +FollowSymLinks +MultiViews
        require all granted
    </Directory>
</VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM