Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Centos server running ePages (which runs on Apache). Now I want to use the same server to host a couple of other sites as well, but I can't seem to get my configs working correctly. I'm not sure if anyone is familiar with epages (I've looked on their forums to no avail), but this is the epages bit of the config:

<VirtualHost _default_:80>
<Location /epages/>
<IfDefine LB>
    ProxyPass balancer://cluster/epages/
    ProxyPassReverse balancer://cluster/epages/
</IfDefine>
<IfDefine !LB>
    ProxyPass http://myinternal.url:8008/epages/
    ProxyPassReverse http://myinternal.url:8008/epages/
</IfDefine>
</Location>
</VirtualHost>

and this is what I've added

<VirtualHost my.ip.add.res:80>

DocumentRoot /var/www/html/path/
ServerName another.url.com
ServerAlias another.url.com

</VirtualHost>

Now I was under the impression that any request to "another.url.com" will go to the DocumentRoot which I have added, and any other request will go to the default which epages will handle.

However, no matter how I go to the server, with any of the URLs pointing to it, it always goes to the new vhost which I have added, and never goes to epages anymore.

I don't want to change the epages configuration if possible, can anyone shed any light as to what's happening here?

There is a lot more to the epages configurations, but not related to VirtualHosts so I havent pasted it, but if I need to then let me know.

Thanks

share|improve this question

1 Answer 1

I've just been struggling with this myself. Isn't ePages fun?

There a number of ways in which the ePages Apache configuration differs from a more "normal" site.

1. It rewrites most of the config files every time the ePages service restarts.

Anything with a "zzz" prefix (which is most of the files in conf.d) will be rewritten, so don't bother editing those files.

2. It doesn't use name-based virtual hosts.

If you look in conf/httpd.conf you'll see the NameVirtualHost directive is commented out. This means your VirtualHost directives will be activated by IP address, not hostname. So in your example above, if my.ip.add.res happens to be the default IP of the server then your VirtualHost block will be ignored in favour of the one that came before it. You can either get a secondary IP address and use that in your second VirtualHost (and then get a new IP for every new VirtualHost you need), or you can uncomment the NameVirtualHost directive. But:

3. It defines a VirtualHost inside an IfDefine block.

This might vary from version to version, but in my case (6.14.3) the one and only VirtualHost block sits inside an <IfDefine PROXY> block (conf.d/zzz-epages-httpd.conf). Meaning that if you define your own VirtualHost, and your server doesn't define a PROXY environment variable, your VirtualHost will be the only one and will therefore be in effect for all requests. To be safe, define two VirtualHosts: one that will work for epages and one for your other site. If PROXY is defined, your epages VirtualHost will be ignored, otherwise it will be a necessary filter. Note also that ePages relies on mod_rewrite, so this "safety net" VirtualHost will need to enable it.

This is what worked for me in the end:

# file: /etc/httpd/conf/httpd.conf
# find and uncomment the NameVirtualHost directive,
# then add this at the very end of the file

<VirtualHost *:80>
    ServerName www.myepageswebsite.com
    ServerAlias myepageswebsite.com
    RewriteEngine On
    RewriteOptions Inherit
</VirtualHost>
<VirtualHost *:80>
    ServerName www.myotherwebsite.com
    ServerAlias myotherwebsite.com
    DocumentRoot /var/www/html
</VirtualHost>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.