Using a directory in VirtualHost ServerName

后端 未结 3 1112
[愿得一人]
[愿得一人] 2020-12-07 23:08

I\'m currently using name-based virtual host configuration, to server about 5 different websites from the same IP address, just like in the apache documentation:

<         


        
相关标签:
3条回答
  • 2020-12-07 23:43

    It's not possible the way you show - a VirtualHost is always just a host. But you could use an Alias.

    <VirtualHost *:80>
    ServerName www.domain.tld
    DocumentRoot /www/domain
    
    Alias /folderpath /www/software
    
    </VirtualHost>
    
    0 讨论(0)
  • 2020-12-07 23:43

    Is it possible to have a different vhost for each application like that:

    <VirtualHost *:80>
    ServerName www.domain.tld
    DocumentRoot /www/domain
    </VirtualHost>
    
    <VirtualHost *:80>
    ServerName www.domain.tld
    Alias otherApp /www/otherApp
    </VirtualHost>

    0 讨论(0)
  • I add to the alias.conf file (on a windows machine).
    Remember that if it outside the 'document root' path, you'll need permissions

    <IfModule alias_module>
    
        #### FolderPath ####
        Alias /folderpath "E:/any/path/you/like"
    
        <Directory "E:/any/path/you/like">
            Options Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    
        #### Another ####
        Alias /another "E:/another/different/path"
    
        <Directory "E:/another/different/path">
            Options Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    
    </IfModule>
    
    0 讨论(0)
提交回复
热议问题