Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just un-installed XAMPP and decided to take into use the Apache included within OS X. After a lot of fiddling around I've gotten it to somewhat work, but not quite.

I use VirtualHostX for managing vhosts to my local projects. When I add a vhost (e.g. project.dev -> htdocs/Project) using the app, that vhost will work properly.

However, when I try to access localhost, things get weird. Let's say I navigate to localhost/foo on my browser. It gives 404, and this can be found in the error-logs:

[error] [client 127.0.0.1] File does not exist: /path/to/htdocs/Project/foo

So, basically it seems that the first vhost I have set up defines the folder where localhost/* tries to look for files.

Any ideas? It is very possible I've messed up some configuration by either using XAMPP or VirtualHostX.

share|improve this question

2 Answers 2

You also need to set the main document root in the http.conf file. Otherwise Apache will use the first vhost avaible.

share|improve this answer
    
It is set to the appropriate path: DocumentRoot "/same/path/to/htdocs". Also the appropriate <Directory>-tag is edited properly. –  Martti Laine Jun 8 '13 at 11:04
    
Maybe post a (censored) version of your conf file. –  DaGardner Jun 8 '13 at 11:05
    
What portions do you think would be most useful? The whole file is pretty long. I can copy the parts that would help. –  Martti Laine Jun 8 '13 at 12:19
    
Where you define the vhost and document root, –  DaGardner Jun 8 '13 at 16:27

You need to set up a localhost vhost. Once you enable virtual hosting, Apache uses the first vhost if no vhost match, as outlined in the documentation: http://httpd.apache.org/docs/current/en/vhosts/name-based.html.

share|improve this answer
    
I've tried using VirtualHostX to set a vhost like this: localhost -> /path/to/htdocs, but I get error 403 Forbidden. Here's an example of the lines that show up in logs (when requesting localhost/foo): [error] [client ::1] mod_hfs_apple: Mis-cased URI: /path/to/htdocs/foo, wants: /path/to/htdocs/ –  Martti Laine Jun 8 '13 at 18:24

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.