I installed apache2, mysql, php and phpmyadmin . The root location is in /var/www now but i wanted to change it to something like /home/user/sites or something. In the other threads , the solution was adding some code in the 000-default.conf file in sites-enabled folder , but there is no such file in my folder, infact there is no file in /etc/apache2/sites-enabled folder. So how do i change the location now?

$ ls -l  /etc/apache2/sites-enabled
total 0

$ ls -l /etc/apache2/sites-available
total 16
-rw-r--r-- 1 root root 1582 अक्टूबर 17 07:26 000-default.conf
-rw-r--r-- 1 root root 1338 अक्टूबर 13 22:51 000-default.conf~
-rw-r--r-- 1 root root 6432 जुलाई  21  2013 default-ssl.conf

$ apt-cache policy apache2
Installed: 2.4.6-2ubuntu2.2
  Candidate: 2.4.6-2ubuntu2.2
  Version table:
 *** 2.4.6-2ubuntu2.2 0
        500 http://np.archive.ubuntu.com/ubuntu/ saucy-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu/ saucy-security/main i386 Packages
        100 /var/lib/dpkg/status
     2.4.6-2ubuntu2 0
        500 http://np.archive.ubuntu.com/ubuntu/ saucy/main i386 Packages

Content of 000-default.conf is:

$ cat /etc/apache2/sites-enabled/000-default.conf     
<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 /home/buffhead/Sites
    # 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
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
DocumentRoot /home/buffhead/Sites/
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /home/buffhead/Sites/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

And content of new DocumentRoot:

$ ls -l /home/buffhead/Sites/
total 4
-rw-r--r-- 1 root root 25 अक्टूबर 13 15:12 info.php
  • Please edit your post and add the output of ls -l /etc/apache2/sites-enabled, ls -l /etc/apache2/sites-available and apt-cache policy apache2.
    – muru
    Oct 17, 2014 at 2:23

1 Answer 1


To change the default location, edit /etc/apache2/sites-available/000-default.conf. Then do:

sudo a2ensite 000-default.conf
sudo service apache2 restart

And upgrade to Ubuntu 14.04 while you're at it. 13.10 is obsolete and no longer supported.

The permission error might be because it doesn't have access to the /home/buffhead/Sites/ folder. Do:

chmod o+x /home/buffhead
chown :www-data -R /home/buffhead/Sites/
chmod g+rxs /home/buffhead/Sites/

This should let apache access the files in /home/buffhead/Sites/, and files created in it should retain the www-data group.

  • what to edit? i tried adding DocumentRoot /home/buffhead/Sites/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /home/buffhead/Sites/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> still not working
    – prasum
    Oct 17, 2014 at 2:59
  • @prasannamishra that could be due to any number of reasons: permissions issues, configuration errors, etc. Hard to tell. Edit your question, and post the output of cat /etc/apache2/sites-enabled/000-default.conf, and the output of ls -l /home/buffhead/Sites/.
    – muru
    Oct 17, 2014 at 3:01
  • After editing 000-default in sites-available , the error 404 changed to error 403 Forbidden You don't have permission to access /info.php on this server.
    – prasum
    Oct 17, 2014 at 3:06

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