Reputation: 113
Maybe an old topic, but i'm kinda stuck with an actual simple vhost configuration. Maybe I'm just missing something...
I would like to confige a virtual machine with some software products. What I already did: - Jenkins bitnami stack: works fine on dev.company.com:8080/jenkins
Installation of httpd via yum - Set up my SVN Repository via WebDAV: Works fine as well on port 80 at dev.company.com/repo
Configfile at /etc/httpd/conf.d
<Location /repo>
DAV svn
SVNParentPath /srv/svn/repositories/
SVNListParentPath on
#<LimitExcept>
# GET PROPFIND OPTIONS REPORT>
AuthType Basic
AuthName "SVN Authorization Realm"
AuthUserFile /etc/svn-auth-conf
Require valid-user
#</LimitExcept>
</Location>
Configfile at /etc/httpd/conf.d
<VirtualHost *:80>
DocumentRoot /home/redmine/redmine/public
ServerName dev.company.com
ServerAlias www.dev.company.com
DirectoryIndex index.html index.php
Alias /redmine /home/redmine/redmine/public
PassengerLogLevel 3
RailsEnv production
PassengerDefaultUser apache
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /home/redmine/redmine/public
</Location>
<Directory /home/redmine/redmine/public>
Order allow,deny
Allow from all
AllowOverride All
Require all granted
Options -MultiViews
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
</VirtualHost>
PassengerPreStart http://dev.company.com
now i would like to set up another vhost config file to /opt/project and /var/www/project
My Vhost config Files look like:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName dev.company.com/test
DirectoryIndex index.html index.php
Alias /test /var/www/html
<Directory /var/www/html>
Options all
Order allow,deny
Allow from all
AllowOverride All
Require all granted
PassengerEnabled off
</Directory>
<VirtualHost *:80>
DocumentRoot /opt/test
ServerName dev.company.com/test2
DirectoryIndex index.html index.php
Alias /test /opt/test
<Directory /opt/test>
Options all
Order allow,deny
Allow from all
AllowOverride All
Require all granted
PassengerEnabled off
</Directory>
Always the first config file is read and working on dev.company.com:80. All following vhost config files are being ignored.
Default httpd.conf file with default Directory setting and just added NameVirtualHost *:80 (default Listen 80). I also included 127.0.0.1 dev.company.com/test... to /etc/hosts file and restarted the httpd service serveral times (and the complete virtual machine as well).
Maybe it's just a simple thing - but i don't have any clue. Does someone has any Idea? I'd really appreciate that!
Upvotes: 0
Views: 466
Reputation: 374
As far as I'm aware you can't specific two different DocRoots for the same VH. You'll probably need to use Alias as below
<VirtualHost *:80>
DocumentRoot /home/redmine/redmine/public
ServerName dev.company.com
ServerAlias www.dev.company.com
DirectoryIndex index.html index.php
Alias /redmine /home/redmine/redmine/public
Alias /test /var/www/html
Alias /test2 /opt/test
PassengerLogLevel 3
RailsEnv production
PassengerDefaultUser apache
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /home/redmine/redmine/public
</Location>
<Directory /home/redmine/redmine/public>
Order allow,deny
Allow from all
AllowOverride All
Require all granted
Options -MultiViews
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
<Directory /var/www/html>
Options all
Order allow,deny
Allow from all
AllowOverride All
Require all granted
PassengerEnabled off
</Directory>
<Directory /opt/test>
Options all
Order allow,deny
Allow from all
AllowOverride All
Require all granted
PassengerEnabled off
</Directory>
</VirtualHost>
Upvotes: 1