-2

I have this configuration, a file z500.trunk in /etc/apache2/sites-enabled/ (it's symlink to file in sites-available):

<VirtualHost 127.0.2.1:80>
    DocumentRoot "/home/kuba/projects/z500/trunk/www"
    ServerName z500.trunk
    Alias /FilesZ500 "/home/kuba/projects/z500/files"
    Alias /css-cache "/home/kuba/projects/z500/trunk/tmp/css"
    Alias /js-cache "/home/kuba/projects/z500/trunk/tmp/js"
</VirtualHost>

and in /etc/hosts:

127.0.2.1       z500.trunk

but when I access the site using a browser (http://z500.trunk/), I've got normal default page, not the virtual one.

It was working in 13.04, what's wrong here?

jcubic
  • 230
  • 1
  • 4
  • 15

2 Answers2

2

Ubuntu 13.10 uses Apache 2.4 now, which comes with some changes that may affect you:

The VirtualHost's default location is in extra/httpd-vhosts.conf, though this filename is not mandatory.

If you do choose to go with another file naming scheme, they will need to end in .conf unlike the previous rules.

I would check your httpd.conf and make sure you have an Include for your vhosts.

Include etc/apache24/extra/httpd-vhosts.conf

As a side note, Apache 2.4 allows for variables to be used in the configuration. This is nice when it comes to configuring large amounts of virtualhosts.

The following example obviously doesn't work with your names or directory structure. I am just throwing this out there for the sake of spreading information. I love the feature, and I hope more people adopt it.

<VirtualHost 127.0.2.1:80>
    Define SN z500.trunk
    DocumentRoot "/home/kuba/${SN}/www"
    ServerName ${SN}
    Alias /FilesZ500 "/home/kuba/${SN}/files"
    Alias /css-cache "/home/kuba/${SN}/tmp/css"
    Alias /js-cache "/home/kuba/${SN}/tmp/js"
</VirtualHost>
David Houde
  • 3,200
  • 1
  • 16
  • 19
  • I don't have `apache24` or `extra` directory, but when I upgrade they ask if I want to keep php.ini file (I said yes) maybe it keep all files from apache2. – jcubic Mar 13 '14 at 11:52
  • I purge the package and install again and have the same no extra directory. When I change my file (and symlink) to z500.trunk.conf I've got 403 error. – jcubic Mar 13 '14 at 12:13
0

As @DavicHoude said the file needed to have .conf extension and need AllowOverride All for directory because .htaccess was not working (I've got 403 errors):

<VirtualHost 127.0.2.1:80>
    DocumentRoot "/home/kuba/projects/z500/trunk/www"
    ServerName z500.trunk
    <Directory /home/kuba/projects/z500/trunk/www>
        Options +Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    Alias /FilesZ500 "/home/kuba/projects/z500/files"
    Alias /css-cache "/home/kuba/projects/z500/trunk/tmp/css"
    Alias /js-cache "/home/kuba/projects/z500/trunk/tmp/js"
</VirtualHost>
jcubic
  • 230
  • 1
  • 4
  • 15