-1

I have a Virtual Host set up in apache to run CodeIgniter:

<VirtualHost *:80>
   DocumentRoot "/var/www/CodeIgniter"
   ServerName codeigniter.loc
</VirtualHost>

Problem is, when I point my browser to 127.0.0.1, I'm getting the CodeIgniter home page instead of a list of the files in my root directory. Why is apache doing this?

2
  • Why would you expect 127.0.0.1 to show you a list of the files in your root directory? Do you expect it to act like a file browser, or did you have another virtualhost setup to do this for you via Apache?
    – covener
    Feb 3 '13 at 21:00
  • Not a file browser, just a standard apache page where there is no index file included
    – symlynk
    Feb 3 '13 at 21:04
1

Because you've told it to direct all requests, regardless of what IP address they are from, to codeigniter. That's what the '*:80' part of your virtual host config is doing.

Try changing that to only use the IP address of the network adapter that you want to be listening for requests for the code igniter site.

1

Unless told otherwise, Apache will direct traffic to the first VirtualHost specified. You could get around this by making a new Vhost for the root dir, which would obviously stop your CodeIgniter site from loading.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.