Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Custom / Complex Apache Virtualhosts and CPanel

Discussion in 'EasyApache' started by AlbacoreNerd, Aug 2, 2006.

Thread Status:
Not open for further replies.
  1. AlbacoreNerd

    AlbacoreNerd Registered

    Aug 2, 2006
    Likes Received:
    Trophy Points:
    I am attempting to migrate a series of eZpublish-based sites (PHP with a number of rewrite rules and other Apache configuration requirements) from an existing server to a new server running cpanel. Typical eZpublish installations use a few different hostnames (www, admin, and webdav in this example), along with a number of rewrite rules, etc. I'm attempting to figure out some "best practices" for setting up the proper virtualhost configrations when using cpanel.

    On all of our existing servers, I tried to keep the virtualhost configurations from cluttering up httpd.conf with something like this:

    1) Create a directory such as /example/apache/conf/virtualhosts/
    2) Put all virtualhost configurations into this directory as individual files (i.e. www.domain.tld.conf)
    3) Update httpd.conf to read these files: Include /example/apache/conf/virtualhosts/*.conf

    The primary reason for this is that eZpublish virtualhost configurations are somewhat complicated. See below for an example.

    So my question is, what is the best way to do something similar with cpanel (while not losing cpanel's controls over the virtualhost)?


    ### Virtual Host:
    ### www.domain.tld (ezpublish)

    NameVirtualHost www.domain.tld
    NameVirtualHost admin.domain.tld
    NameVirtualHost webdav.domain.tld

    <VirtualHost www.domain.tld>
    <Directory /example/apache/sites/www.domain.tld/ezpublish-3.6.5>
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all

    <IfModule mod_php4.c>
    php_admin_flag safe_mode Off
    php_admin_value register_globals 0
    php_value magic_quotes_gpc 0
    php_value magic_quotes_runtime 0
    php_value allow_call_time_pass_reference 0

    DirectoryIndex index.php

    <IfModule mod_rewrite.c>
    RewriteEngine On
    Rewriterule ^/var/storage/.* - [L]
    Rewriterule ^/var/[^/]+/storage/.* - [L]
    RewriteRule ^/var/cache/texttoimage/.* - [L]
    RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
    Rewriterule ^/design/[^/]+/(stylesheets|images|javascript|htc)/.* - [L]
    Rewriterule ^/share/icons/.* - [L]
    Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts|htc?)/.* - [L]
    Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
    RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
    RewriteRule ^/favicon.ico - [L]
    RewriteRule ^/robots.txt - [L]
    # Uncomment the following lines when using popup style debug.
    # RewriteRule ^/var/cache/debug.html.* - [L]
    # RewriteRule ^/var/[^/]+/cache/debug.html.* - [L]
    RewriteRule .* /index.php

    DocumentRoot /example/apache/sites/www.domain.tld/ezpublish-3.6.5
    ErrorLog /example/apache/sites/www.domain.tld/logs/error_log
    CustomLog /example/apache/sites/www.domain.tld/logs/access_log combined
    php_value include_path .:/example/apache/sites/www.domain.tld/php:/usr/lib/php

    ServerName www.domain.tld
    ServerAlias admin.domain.tld
    ServerAlias webdav.domain.tld
  2. AlbacoreNerd

    AlbacoreNerd Registered

    Aug 2, 2006
    Likes Received:
    Trophy Points:

    BTW: I realize that some of the items in the example above can already be handled easily by cpanel (i.e. ServerName, ServerAlias, and NamedVirtualhost can be done with addon domains, etc.), and could simply be removed. My question is more about the general concept of customized virtualhosts, than the specific configuration requirements above. :)
    #2 AlbacoreNerd, Aug 2, 2006
    Last edited: Aug 2, 2006
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice