Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I can access localhost but not the sub directories index.html

My default conf looks like:

<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/*/>
    Allow from None
    Order allow,deny
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    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 ${APACHE_LOG_DIR}/error.log

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

CustomLog ${APACHE_LOG_DIR}/access.log combined

Even after allowing read/edit/write access to the directory, its showing Forbidden error. Tried all possible ways out in forums, didnt worked. Anyone has a solution.

Between above I tried something for sub directory access:

<Directory /var/www/*/>
    Allow from None
    Order allow,deny
</Directory>

Please suggest me possible solution. Thanks!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Let's make it clear the vhost:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        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 ${APACHE_LOG_DIR}/error.log

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

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Then make sure you set the permission like this:

sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www
share|improve this answer
    
I did so. Still the same. Restarted apache as well. Should I try to modify in apache.conf instead? –  Shobhit Sharma May 9 '13 at 10:18
    
Here is the thing. I tried to change root directory, to my home folder index and its still pointing to /var/www. Gotta find right conf file. –  Shobhit Sharma May 9 '13 at 10:24
    
@ShobhitSharma Please try the updated one. If you trying to locate your vhost directory to home folder, you should create a different vhost change only DocumentRoot /var/www instead of modifying the default one. –  Achu May 9 '13 at 10:32
    
Worked! I took the note from it! Thanks a lot! –  Shobhit Sharma May 9 '13 at 10:40

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.