1

In fact I just want to change the web directory to another folder in Ubuntu, but 403 forbidden error give a mass to me.

I have tried a lot of ways on google to solve this problem, but those solutions can not solve my problem, such as change the permission of the folder,

This is /etc/apache2/sites-enabled/000-default.conf file (see comments on lines with ##############):

<VirtualHost *:80>

# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /usr/www 
############## (if I change to /var/www no forbidden)

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

and this is /etc/apache2/apache2.conf file

<Directory /usr/www/>
############## (if I change this to /var/www/ no problem.)
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

who can help me?

1
  • Have you changed the permissions for the new directory (/usr/www in this case)? These should probably be the same as /var/www. And the owner (www-data probably). Sep 14, 2014 at 12:20

1 Answer 1

0

I suggest you to follow this workaround which work without problems in the majority of the cases.

How to redirect apache /var/www to the home directory and access all the directories and files in my home directory?

But have in consideration that if you make the changes for a reserved or protected directory you must give the proper permissions in order to allow access to everybody.

Please inform if you experience any issues when trying with this workarund.

Good luck!

Not the answer you're looking for? Browse other questions tagged .