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)?
Thanks,
Eric
###
### 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
</Directory>
<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
</IfModule>
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
</IfModule>
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
</VirtualHost>
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)?
Thanks,
Eric
###
### 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
</Directory>
<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
</IfModule>
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
</IfModule>
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
</VirtualHost>