linux -- ubuntu 安装apache后,修改默认路径

默认由apt方式安装的Apache,指定网页主目录位于:/var/www

而系统/var所分到的空间太少,所以要换路径

1、修改默认网站目录

ubuntu8.10下修改apache2的默认文档目录 默认是在/var/www里面

sudo gedit /etc/apache2/sites-enabled/000-default

在文档中找到 DocumentRoot 在后面修改你要放置网页文件的目录。

修改完了 别忘记重启apache2服务器

命令: sudo /etc/init.d/apache2 restart

2、修改默认主页

输入这个命令 grep -iR DirectoryIndex /etc/apache2,查看 DirectoryIndex 在apache2文件夹的哪个文件里面

修改默认主页:一般在 sudo gedit /etc/apache2/apache2.conf里面

找到 DirectoryIndex 在后面添加 如index.php等

3.修改可覆盖,apache2.conf下

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

修改为

<Directory />

Options Indexes FollowSymLinks

AllowOverride None

</Directory></span>