SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Improve Virtual Host File

    How can I improve this virtual host file. It seems really redundant for my sub domains.

    Code:
    <VirtualHost *:80>
            DocumentRoot /var/www/jasonbiondo.com/jasonbiondo.com
            ServerName jasonbiondo.com
    
             <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
            DocumentRoot /var/www/jasonbiondo.com/dev.jasonbiondo.com
            ServerName dev.jasonbiondo.com
    
             <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
            DocumentRoot /var/www/jasonbiondo.com/fun.jasonbiondo.com
            ServerName fun.jasonbiondo.com
    
             <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
            DocumentRoot /var/www/jasonbiondo.com/stock.jasonbiondo.com
            ServerName stock.jasonbiondo.com
    
             <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Jason,

    They're supposed to be! Each subdomain is treated as a separate domain with the www being default. Each can be hosted on a different server and each can have its own DocumentRoot, i.e., it's all required.

    As for the <Directory> entries, they appear to repeat server configurations so, if you modify the server, they will be inherited (and your vhosts entries can change the default from the server). If they're set as you have them in the server, you can delete these as redundant.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Jason,

    They're supposed to be! Each subdomain is treated as a separate domain with the www being default. Each can be hosted on a different server and each can have its own DocumentRoot, i.e., it's all required.

    As for the <Directory> entries, they appear to repeat server configurations so, if you modify the server, they will be inherited (and your vhosts entries can change the default from the server). If they're set as you have them in the server, you can delete these as redundant.

    Regards,

    DK
    DK,

    How do I set this to be configured on my server? What are the advantages / disadvantages?

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Jason,

    Edit the httpd.conf (in the directory above the extras where the httpd-vhosts.conf file resides). Search that file for each of those core directives and set appropriately then save the file back to the server and restart Apache. The advantage is that those directives need to be read only once, not for each pass through the .htaccess (each .htaccess in the path) multiple times (until no further matches are discovered) for each file request (yes, including the css, js, jpg, gif, etc., files!). Get the message? Not to move that to the server's config file is an abuse of the server (and, IMHO, should never be tolerated on a shared server).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •