Solved

Apache 2.2 Config Help

Posted on 2010-09-02
18
372 Views
Last Modified: 2012-06-21
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,
0
Comment
Question by:ycgtech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
18 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33593977
On my Ubuntu system "/var/www" is the Apache web root, not "/var/www/html".
0
 
LVL 7

Expert Comment

by:mchkorg
ID: 33594224
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
 
LVL 2

Expert Comment

by:Orcen
ID: 33594342
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:samri
ID: 33595067
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
 
LVL 3

Author Comment

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

Thanks
0
 
LVL 3

Author Comment

by:ycgtech
ID: 33608469
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
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33608527
Which OS or version of Linux are you using?  They don't all set up Apache the same way.
0
 
LVL 3

Author Comment

by:ycgtech
ID: 33608533
Centos 5
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33608576
What do you have for "DirectoryIndex"?  I use "index.html index.htm index.php index.shtml".
0
 
LVL 3

Author Comment

by:ycgtech
ID: 33608584
index.html index.html.var
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33608609
What do you get with "http://localhost/index.html"?
0
 
LVL 3

Author Comment

by:ycgtech
ID: 33608621
The "It Works" page.
0
 
LVL 3

Author Comment

by:ycgtech
ID: 33608623
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
 
LVL 3

Author Comment

by:ycgtech
ID: 33608630
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
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33608655
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
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 33608664
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
 
LVL 3

Author Closing Comment

by:ycgtech
ID: 33608701
Thanks, points awarded for sticking with me and helping me out until I realized there were mutiple copies.

Thanks again!
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33608751
Thanks and you're welcome.  I know from experience that Apache can be a real pain to set up.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web site: http forwards to https causing 301 errors - SEO issue? 26 77
Shrink Linux Swap File Size CentOS 10 72
what is socket pooling? 8 79
NFS v4 7 75
The purpose of this article is to demonstrate how we can use conditional statements using Python.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question