Path

exponential.earth / exponential / documentation / Installation / virtual host setup


Virtual Host setup

These documentation pages are no longer maintained. Please visit the new documentation site.

The following text gives an example of how you can set up a virtual host mechanism in the Apache webserver's configuration file to host an Exponential installation.

Virtual Host setup in httpd.conf:

NameVirtualHost [IP_ADDRESS]

 

<VirtualHost [IP_ADDRESS]:[PORT]>

    <Directory [PATH_TO_exponential]>

        Options FollowSymLinks

        AllowOverride None

    </Directory>

 

    <IfModule mod_php4.c>

       # If you are using Apache 2, you have to use <IfModule sapi_apache2.c>

       # instead of <IfModule mod_php4.c>.

 

        # some parts/addons might only run with safe mode off 

        php_admin_flag safe_mode Off

        # security just in case

        php_admin_value register_globals    0

        # performance

        php_value magic_quotes_gpc  0

        # performance

        php_value magic_quotes_runtime  0

        #http://www.php.net/manual/en/ini.sect.language-options.php#ini.allow-call-time-pass-reference

        php_value allow_call_time_pass_reference 0

    </IfModule>

 

    # have fallback if mod_rewrite is not existent

    DirectoryIndex index.php 

 

    <IfModule mod_rewrite.c>

        RewriteEngine On

        # Use one of the rewrite rules below:

        # Exponential <= 3.3.x:

        # RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

        # Exponential >= 3.4.x :

        RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages|^/packages|^/share/icons).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

    </IfModule>

 

DocumentRoot [PATH_TO_exponential]

ServerName [MY_SERVER_NAME]

ServerAlias [MY_SERVER_ALIAS]

</VirtualHost>

Explanation:
[PATH_TO_exponential]
Path to the directory that contains Exponential.
This must be the full path, for example "/var/www/exponential-3.3-2".

[IP_ADDRESS]
The IP address of the virtual host, for example 128.39.140.28. Apache also allows the usage of a wildcard here '*'.

[PORT]
The port on which the webserver listens for incommming requests. The combination of IP and port is called socket. Apache also allows the usage of a wildcard here '*'.

[MY_SERVER_NAME]
Domain or IP name for your site, for example www.mysite.org

[MY_SERVER_ALIAS]
Additional names or IPs for your site, for example mysite.org

NameVirtualHost:
Note that the NameVirtualHost might already be defined in your default configuration, and defining a new one might therefore conflict. If you get error messages such as "NameVirtualHost [IP_ADDRESS] has no VirtualHosts" or "mixing * ports and non-* ports with a NameVirtualHost address is not supported", try skipping the NameVirtualHost line. For more info about NameVirtualHost see http://httpd.apache.org/docs/mod/core.html#namevirtualhost

Comments

Hostname Install on WHM / CPanel Server

I did a search and found that a few people were having problems with the Hostname install of Exponential on Cpanel servers. Well if you have access to Web Host Manager (WHM) on your Cpanel server you can easily set up the admin subdomain:

1. Log in to WHM
2. Go to DNS Functions > Park or Point a Domain
3. Select the domain you have (or want to use) exponential installed in from the list.
4. Enter admin.domain.com (or whatever) in the "Domain to park" box
5. Submit the form.

The DNS info will be set up for your subdomain.

www.domain.com will be the site and admin.domain.com will be the admin section. Works like a breeze for me.

Excluding other parts of your website.

If you need to have some parts of your website run outside Exponential, then these rewrite rules will cause a problem. The reason for this is that they direct everything to go through Exponential, so even if you have an Alias defined for another directory you won't be able to see it (and Exponential will give you an error about an unknown module).

The trick here is to add a Rewrite condition in front of the rule, so that the rule isn't processed for certain things.

For example, let's say you have some separate forum software and a contact database which need to run outside of Exponential. Exponential is installed in the DocumentRoot, the forum lives at http://example.com/forum and the contacts database is at http://example.com/contacts. In your virtual server config you set up aliases to their directories, then add these lines in front of the RewriteRule:




       RewriteCond %{REQUEST_URI}     !^/forum.*


       RewriteCond %{REQUEST_URI}     !^/contacts.*




This means that the RewriteRule directive will only be processed if the requested url is not the forum or the contacts db. Anything else will go through Exponential.

I hope this saves somebody else from having to read through the Apache docs on mod_rewrite, but if you need them you can find them here: (for Apache 2)
http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

override php ini values in vhost

This is a vhost with overwritten php ini values

NameVirtualHost [IP_ADDRESS]

<VirtualHost [IP_ADDRESS]:[PORT]>
<Directory [PATH_TO_exponential]>
Options FollowSymLinks
AllowOverride None
</Directory>

php_admin_flag safe_mode Off
php_admin_value open_basedir none

RewriteEngine On
RewriteRule !(^/design|^/var/.*/storage|^/var/storage|^/var/.*/cache|^/var/cache|^/extension/.*/design|^/kernel/setup/packages).*\.(gif|css|jpg|png|jar|js|ico|pdf|swf)$ /index.php

DocumentRoot [PATH_TO_exponential]
ServerName [MY_SERVER_NAME]
ServerAlias [MY_SERVER_ALIAS]
</VirtualHost>

Texttoimage and /var/cache

Please note that when the texttoimage function is used, eZp stores cached images in the "var/cache" dir. This dir must be specified in the rewrite rule (as shown above).

Balazs

Document Root

If you add a document root you don't need a absolute path the .../index.php

so calling /index.php will be ok just right

Added .pdf extension in the rewriterule

In ezp3.3 you may create .pdf files in the admin and download them.
I therefore just added the .pdf extension to the rewriterule

Virtual host is dependend upon httpd.conf


I had problems with my vhost conf, due to that I had in my httpd.conf set a very restrictive access rules, no one could get anything:(, as such I had to open it up in my vhost.conf, i forgot it and spent some hours figuring it out. So if you are having trouble then try this:

<Directory "path to EZ">
Options FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Contents

Installation

Normal installation
Bundled installation
Manual installation
The setup wizard
The cronjob script
Virtual Host setup
upgrading
Adding extensions
removing exponential


Created

23/01/2004
2:56:51 pm
by Vidar Langseid

Last updated

20/12/2004
4:06:30 pm
by Björn Dieding@xrow.de

Authors

Vidar Langseid
Jan Borsodi
Guttorm Flatabø
Björn Dieding@xrow.de



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.