Apache2 Dynamic vHost with multiple ServerAlias

后端 未结 2 584
北恋
北恋 2021-01-14 04:39

I am trying to set up a dynamic vHost, but have run into some trouble. It will not allow me to set multiple ServerAlias.


        Se         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 05:04

    Figured it out!

    'www.*.com' must execute before '*.com' This is because ServerAlias is setting a dynamic domain and must exist before a "smaller" alias exists.

    Example: 'www.*.com', 'dev.*.com', 'asdf.*.com' THEN '*.com'

    vHost File [production.conf]:

    
        ServerAlias www.*.com
        VirtualDocumentRoot /var/www/%2/production/html
        ServerAdmin michael.ian.curry@gmail.com
        
            Options FollowSymLinks
            AllowOverride None
        
        
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        
    
        LogLevel warn
    
    
    
        ServerAlias *.com
        VirtualDocumentRoot /var/www/%1/production/html
        ServerAdmin michael.ian.curry@gmail.com
        
            Options FollowSymLinks
            AllowOverride None
        
        
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        
    
        LogLevel warn
    
    

    I hope this helps anyone else that is having this problem!

    --MichaelCurry

提交回复
热议问题