Apache2 - 如何使用不同的网址构建不同的站点

Apache2 - How to build different site with different web address

我想在相同的 IP 中创建站点但具有不同的子文件夹,例如:
http://192.168.0.1/a/ --> /var/www/site_a/
http://192.168.0.1/b/ --> /var/www/site_b/

配置:

<VirtualHost *:80>
    #Site name
    ServerName 192.168.0.1

    #Root folder
    DocumentRoot /var/www/site_a/

    #log
    ErrorLog /var/www/binapk/logs/error.log

    #Access log
    CustomLog /var/www/binapk/logs/access.log combined

    Alias /a /var/www/site_a/
    Alias /b /var/www/site_b/
</VirtualHost>

但是如果你输入 http://192.168.0.1 (without /a or /b), it will show the same page as http://192.168.0.1/a/, I want http://192.168.0.1/ 什么也没有显示。

怎么做?

您指定 DocumentRoot 的几行:

#Root folder
DocumentRoot /var/www/site_a/

正在将您的 http://192.169.0.1/ 指向 /a 文件夹,您可能希望将其指向其他位置以便加载不同的文档。