Link to home
Start Free TrialLog in
Avatar of ycgtech
ycgtech

asked on

Apache 2.2 Config Help

Hi -
Being that this is the first time I am setting up Apache, I am sure I am just missing something obvious.  However, I have spent hours looking through the docs and on google and have come up empty.

I successfully installed Apache 2.2.  Typing in http://localhost will bring up the "It Works" page.  I then copied my web site to the /var/www/html directory.  However, "It Works" still came up.  The I tried creating a VirtualHost (edited httpd.conf) and then copied the files to /var/www/mywebsite/html.  Same result.  If I browse to the full path as my url (eg: /var/www/mywebsite/html/index.html) the page loads.

What is the obivous that I am missing?

Thanks,
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

On my Ubuntu system "/var/www" is the Apache web root, not "/var/www/html".
I don't think you need any virtualhost for the moment, if your goal is to host one single web site.
You said you've put your files in /var/www/html. I understand your index.html is /var/www/html/index.html
Or move your files to /var/www, not /var/www/html

If this is correct, you'll access your website with this URL: http://localhost/html/index.html (or http://localhost/html/ which points to the default index.html as well)

(I suppose you're just trying to access html regular files, not php and so on (that might require some further configuration and apache/php packages))
Avatar of Orcen
Orcen

You need to open the httpd.conf file and look the correct folder for the 'DocumentRoot' directive. That's the full path where you need to put your html pages, or you can change it to '/var/www/mywebsite/html'

Another issue could be that your index page is a php page, and if you don't have any php module loaded apache will only search for index.html pages.
hi ycgtech,

On Centos box, there is a file in /etc/httpd/conf.d/welcome.conf

If this file is there on your installation, edit the file, and comment all of the lines, or you could move the file to other location, or just delete it.

Avatar of ycgtech

ASKER

Thanks for all of the suggestions.  I will review and then work on it again Saturday night, then I will reply back.

Thanks
Avatar of ycgtech

ASKER

Thanks again for comments.  Here are my replies:

@DaveBaldwin: The httpd.conf file lists /var/www/html as document root.

@mchkorg:  I originally did not have the virtual host setup.  I only went to that step when I could not get it working with the default settings.  Currently the web data is in /var/www/html AND /var/www/mywebsitename/html.  I have an index.html in both of those locations.

@Orcen:  The document root is /var/www/html.  This actually is a php website, but I have the php module installed.  But just to take this out of the loop for troubeshooting purposes (this was the first thing that came to my mind), I created a basic index.html for testing purposes.  Even with the html file the page still does not load.

@samri:  I commented out the lines, and then restarted Apache.  Same thing.  The "It Works" page still loads.

Next troubleshooting step?

Thanks!
Which OS or version of Linux are you using?  They don't all set up Apache the same way.
Avatar of ycgtech

ASKER

Centos 5
What do you have for "DirectoryIndex"?  I use "index.html index.htm index.php index.shtml".
Avatar of ycgtech

ASKER

index.html index.html.var
What do you get with "http://localhost/index.html"?
Avatar of ycgtech

ASKER

The "It Works" page.
Avatar of ycgtech

ASKER

Let me add to my above post:  I have checked and double-checked the web root location.  It is indeed set to /var/www/html.
Avatar of ycgtech

ASKER

Ok, figured it out.  but perhaps you can explain why:  A find for httpd.conf finds multiple files.  The one I was working off of was in /etc/httpd/conf.  There is another one that is in /usr/local/apache2/conf.  Once I edited that one, it worked (well sort of - I have other unrelated issues now that I need to work on).  Why more than one file?
I believe you, Centos sets up Apache different than Ubuntu, I looked it up.  some others use 'htdocs'.  "index.html.var" is a 'map' to other language version of 'index.html'.  If you're not using them, you don't need it.  If you're using PHP, you should have 'index.php' in the "DirectoryIndex" list.

Since you moved your website file to a different location, you should be able to delete all the file in /var/www/html and put in your own 'index.html'.

I just found this... "as of 2.2, there must be a VirtualHost defined that is identical to the default server."
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ycgtech

ASKER

Thanks, points awarded for sticking with me and helping me out until I realized there were mutiple copies.

Thanks again!
Thanks and you're welcome.  I know from experience that Apache can be a real pain to set up.