I am setting up my Ubuntu laptop for my new job and I am having a strange issue. They have a crazy environment setup that I got working on my local Ubuntu 12.10 machine with Apache and PHP 5.3 (had to downgrade from 5.4).

I am able to get the custom app working locally. But when I tried to create a second (and third) simple local site that just uses an index.php file (I want to test some things with PHPUnit) I keep getting Not Found (404) errors.

What I did was created two entries in /etc/hosts that are " test.local" and " test.localhost". From there I added to my virtualhosts.conf file (which apache IS loading) the following:

<VirtualHost *:80>
  DocumentRoot "/virtualhosts/other-sites/test"
  ServerName test.local
  ServerAlias test.localhost
  ServerAlias test.ptlaptop.dev
  Options FollowSymLinks
  RewriteEngine On
  ServerSignature On
  DirectoryIndex index.html index.php

  <directory "/virtualhosts/other-sites/test">
    Options Indexes
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Options FollowSymLinks

This virtualhosts file sites in /etc/apache2/sites-available and is referenced in apache2.conf using "Include sites-enabled/". In that folder there are SymLinks that reference to all of the files in "sites-available". In any case the custom app requires some settings in there to operate, so it would have to be loaded.

Further I have the folder and file for test.local situated in the same base location "/virtualhosts" as the custom app. They have the same permissions and owner (me). I have even tried copying the ".htaccess" file from the custom app to see if something about it did the trick. But nothing seems to be working.

Also, before anyone suggests this, I have restarted apache a bunch of times using "sudo /etc/init.d/apache2 restart". So that isn't the problem either. I have even rebooted the machine.

One last thing, in the hosts file I had to add a line at the top that says " ptlaptop ptlaptop.dev". I'm not sure if that would be causing this problem or not.

So I am not sure why this is giving me so many problems. Any suggestions? Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.