13

I have a site that the root points to /var/www I have set up two folders under /var/www

  1. /var/www/old
  2. /var/www/new

for the old folder, I have used the following to deny any access:

touch /var/www/old/.htaccess && echo deny from all >> /var/www/old/.htaccess

I now want the server to point the root to /var/www/new so that when people visit http://example.com the content in /var/www/new will serve, what should I do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Chris Yeung
  • 2,613
  • 6
  • 34
  • 57

2 Answers2

24

In Ubuntu the Apache configuration is located at /etc/apache2. There should be two folders, sites-available and sites-enabled. Inside sites-enabled are symlinks to config files in sites-available.

You simply have to change the document root in your activated configuration. Thats probably /etc/apache2/sites-enabled/000-default

Have a look for DocumentRoot and change it to /var/www/new, then reload your apache.

Ben
  • 602
  • 4
  • 9
3

depends a LOT on how your apache server is configured.

I don't have an Ubuntu machine around, but what you're looking for is the DocumentRoot directive. On RedHat based machines it's normally in /etc/httpd/conf/httpd.conf but if memory serves Debian based systems use apache instead of httpd.

If that doesn't work be sure to check in /etc/httpd/conf.d since the files there are loaded dynamically.

Hope this helps :)

Nick Andriopoulos
  • 10,313
  • 6
  • 32
  • 56