Method to modify the default directory of Ubuntu Server 10.04

  • 2020-05-07 20:45:16
  • OfStack

Apache installed by apt mode by default in Ubuntu Server 10.04, the specified page home directory is at: /var/www. And I need to change it to: /home/www. Because my system /var allocated too little space, and I have the need to provide network storage via web. Worse still: my /etc /apache2/ sites-enabled / 000-default file disappeared after the modification. The result was an error with the apache service and the site stopped working. In the last part I recorded how to solve this problem.

1. Find the Apache configuration file

# cd /etc/apache2/
apache2.conf and httpd.conf files were found, no configuration was found for directory modification, and http.conf was empty.

2. Search for online

apache2.conf has no DocumentRoot entry, httpd.conf is empty again, www.linuxidc.com must therefore be in another file. A search revealed the following in /etc /apache2/ sites-enabled / 000-default:


<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>

Modification: change the above /var/www to /home/www.

3. Recover the lost /etc /apache2/ sites-enabled / 000-default file

For some reason, the 000-default was lost and the apache service did not work properly. Fortunately, I have a backup server, after checking that 000-default is actually a soft link to.. / sites - available/default file.

# cd /etc /apache2/sites-enabled/
# ln -s ../sites-available/default 000-default
# /etc/init.d/apache2 restart

* Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not determine the server's qualified domain name, using 127.0.1.1 for ServerName
... done.
=== the feedback started by apache above, you can see that apache still has 1 small problem, but it does not affect.

The following table allocates space.

Filesystem Size Used Avail Use% Mounted on
/dev/sda5 1.9G 36M 1.8G 2% /tmp
/dev/sda9 209M 21M 177M 11% /boot
/dev/sda1 276G 7.0G 255G 3% /home
/dev/sda6 8.6G 670M 7.5G 9% /usr
/dev/sda3 1.9G 186M 1.6G 11% /var


Related articles: