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,
LVL 3
ycgtechAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Oh, missed post.  I don't know about extra copies of 'httpd.conf' though that certainly complicates things until you find the right one.  Watch out for multiple copies of 'php.ini' also.

Your setup is quite different than mine on Ubuntu.  I have everything in /etc/apache2 with subdirectories for the Virtual Servers 'conf' files and some other stuff.
0
 
Dave BaldwinFixer of ProblemsCommented:
On my Ubuntu system "/var/www" is the Apache web root, not "/var/www/html".
0
 
mchkorgCommented:
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))
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
OrcenCommented:
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.
0
 
samriCommented:
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.

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

Thanks
0
 
ycgtechAuthor Commented:
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!
0
 
Dave BaldwinFixer of ProblemsCommented:
Which OS or version of Linux are you using?  They don't all set up Apache the same way.
0
 
ycgtechAuthor Commented:
Centos 5
0
 
Dave BaldwinFixer of ProblemsCommented:
What do you have for "DirectoryIndex"?  I use "index.html index.htm index.php index.shtml".
0
 
ycgtechAuthor Commented:
index.html index.html.var
0
 
Dave BaldwinFixer of ProblemsCommented:
What do you get with "http://localhost/index.html"?
0
 
ycgtechAuthor Commented:
The "It Works" page.
0
 
ycgtechAuthor Commented:
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.
0
 
ycgtechAuthor Commented:
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?
0
 
Dave BaldwinFixer of ProblemsCommented:
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."
0
 
ycgtechAuthor Commented:
Thanks, points awarded for sticking with me and helping me out until I realized there were mutiple copies.

Thanks again!
0
 
Dave BaldwinFixer of ProblemsCommented:
Thanks and you're welcome.  I know from experience that Apache can be a real pain to set up.
0
All Courses

From novice to tech pro — start learning today.