Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a basic Apache2 configuration, with only one VirtualHost enabled. I've set the DocumentRoot and the Directory to reference the index directory of the website I would like to display, however when I bring up the server index in a browser, it points to /home/user/public_html rather than /home/user/public_html/website

Is this somehow intended or is my setup incorrect?

Here's the virtualhost setup:

<VirtualHost *:80>
DocumentRoot /home/user/public_html/website

<Directory /home/user/public_html/website/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

share|improve this question
add comment

1 Answer

You can a lot of things to solve this by knowing what is happening. For which simplefying would help. If there is only web virtual host section and it is serving only one website, then why not use the default configuration file and change it appropriately to suit your needs, and compeletly do away with need for virtual host section. That way you will have only one document root and new people to apache httpd usually confuse dns resolution problems with virtual host. For virtual host to work properly you need to have proper dns in place. But if you are using ip then it doesn't matter. In which case Virtualhost wont do dns things and will ultimately fail to serve and then you will be served the global document root. I am not sure if this is the case here. I see you have custom access logs, that is a good move. Instead of defualt log location change the virtualhost access log to another location only during troubleshooting period and then we can revert back. Once you changed the access log location then do a tail -f of the both access logs(default global acess log and virtual section access log that we changed just before) and make sure it is not servering actual traffic, which i think is the case here, then hit the virtual host web site and paralley looking at the access logs you can come to conclusion which section the traffic is flowing and there by isolate the problem. once isolated it should be a piece of cake to solve it. generally it is the misconfigured DNS that causes the mess. But logs will tell you everything you need. In that way nothing gives more explictly the source of the problem as does apache httpd, that too with defualt config. it shows the quality of the software and maturity of the product. httpd is awesome. I have worked on it heavily for one year , about 3 or so years back and afaik, nothing huge has changed and i am following the httpd user mailing list still.

Hope that helps

share|improve this answer
add comment

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.