Ubuntu Server 10.04修改Apache的默认目录的方法
时间:2021-03-15 05:45:47
在Ubuntu Server 10.04中默认由apt方式安装的Apache,指定网页主目录位于:/var/www。而我需要将其更改为: /home/www。因为我的系统/var所分到的空间太少,而我又有提供通过web方式提供网络存储的需要。比较糟糕的是:我的/etc /apache2/sites-enabled/000-default文件在修改后消失掉了。结果导致apache服务出现错误,网站不能运行了。在最后一部分我记录了如何解决这个问题。
一、查找Apache的配置文件
# cd /etc/apache2/
发现apache2.conf和httpd.conf文件,没有找到关于目录修改的配置,且http.conf为空文件。
二、上网搜索
apache2.conf里并没有DocumentRoot项,httpd.conf又是空的,www.linuxidc.com因此肯定在其他的文件中。经过搜索,发现在/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>
修改方法:将上面的/var/www修改为/home/www即可。
三、找回丢失的/etc /apache2/sites-enabled/000-default文件
不知何种原因,000-default竟然丢了,apache服务也不能正常运行了。还好我有一个备用服务器,经查000-default实际上是一个软链接,指向../sites-available/default文件。
# 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 reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
…done.
===由上面apache启动的反馈信息,可以看到apache还是有一点小问题的,不过不影响。
下表为空间分配。
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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win2000 DNS服务器区域的类型
SEO后遗症:如何把从搜索引擎来的用户留下?
分享使用Dedecms建站如何进行搜索优化
Linux DHCP服务器的配置
![](https://img.aspxhome.com/file/UploadPic/20092/2009282109353.jpg)
Linux网络安全经验之谈
CloudStack 安装及使用过程中常见问题汇总
解决ubuntu下vi上下左右方向键出现字母backspace键不能删除字符 问题
西联汇款详细过程!
![](https://img.aspxhome.com/file/UploadPic/200710/2/2007102193655673s.gif)
详解VMware12安装Mac OS X 10.11(图文步骤)
![](https://img.aspxhome.com/file/2023/7/90737_0s.png)
完美听歌享受 酷我音乐盒全面支持 win 7
![](https://img.aspxhome.com/file/UploadPic/200911/2009117162952864.jpg)
木马赚流量牟暴利 非法篡改IE浏览器首页
SEO之域名和主机的影响
VirtualBox 在Centos 7 中安装增强功能图解 (共享文件夹)
![](https://img.aspxhome.com/file/2023/1/103431_0s.png)
Google adsense 何时可以获得付款?
![](https://img.aspxhome.com/file/UploadPic/20079/23/200792381511973s.gif)
VMware安装Centos7超详细过程(图文)
![](https://img.aspxhome.com/file/2023/5/93925_0s.jpg)
一步步教你做支付宝与Wordpress的系统集成
Linux系统中如何添加自己的库文件路径
Web Deploy发布网站及常见问题解决方法(图文)
![](https://img.aspxhome.com/file/2023/2/87062_0s.png)
SupeSite7.0模板样式解析之日志篇
![](https://img.aspxhome.com/file/UploadPic/20099/18/2009918132125448s.jpg)
关于Vmware vcenter未授权任意文件上传漏洞(CVE-2021-21972)的问题
![](https://img.aspxhome.com/file/2023/8/89248_0s.jpg)