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

I have Rails installed for example.com, however, I want to use WordPress for my blog as well. So I want example.com/blog to be WordPress. The problem is, I want to have WordPress in a separate directory from the Rails, such as /srv/www/example-wp and have Rails in /srv/www/example-ruby. How can I separate this? I think it has something to do with virtual hosts, but I am unsure how this is supposed to work.

Update:

<VirtualHost ip:80>
     ServerAdmin support@example.com
     ServerName example.com
     ServerAlias www.example.com
     DocumentRoot /srv/www/example-ruby/public/

Alias /blog /srv/www/example-wp/public/

<Directory /srv/www/example-wp/public/>
        AllowOverride all
        Order allow,deny
        Allow from all
</Directory>

     <Directory /srv/www/example-ruby/public/>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
     </Directory>
</VirtualHost>
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You are looking for the "Alias" function in Apache.

The Alias function allows you to "map" users to a sub-directory outside of the document root.

You would use it like so:

Alias /blog /srv/www/example-wp

http://httpd.apache.org/docs/2.2/mod/mod_alias.html

share|improve this answer
    
I tried adding that to my virtual hosts, but when visiting the URL, Rails just says The page you are looking for doesn't exist. –  Doug Aug 16 '12 at 1:31
    
@Doug Make sure that mod_alias is enabled... "a2enmod alias" –  Soviero Aug 16 '12 at 5:15
    
It says already enabled, and I even did apache2 -M to make sure it's enabled. Is there something I could have missed? –  Doug Aug 16 '12 at 8:11
    
I see that my phpmyadmin Alias is working, but not the one I setup. Is there any reason why it might not work with ServerName or in the sites-available directory? –  Doug Aug 16 '12 at 8:37
1  
I figured it out. You HAVE to use PassengerEnabled off in the directory when using Alias in Apache. Otherwise it will not work. –  Doug Aug 16 '12 at 8:42

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.