Ubuntu Server 10.04修改Apache的默認(rèn)目錄的方法
在Ubuntu Server 10.04中默認(rèn)由apt方式安裝的Apache,指定網(wǎng)頁主目錄位于:/var/www。而我需要將其更改為: /home/www。因?yàn)槲业南到y(tǒng)/var所分到的空間太少,而我又有提供通過web方式提供網(wǎng)絡(luò)存儲的需要。比較糟糕的是:我的/etc /apache2/sites-enabled/000-default文件在修改后消失掉了。結(jié)果導(dǎo)致apache服務(wù)出現(xiàn)錯誤,網(wǎng)站不能運(yùn)行了。在最后一部分我記錄了如何解決這個問題。
一、查找Apache的配置文件
# cd /etc/apache2/
發(fā)現(xiàn)apache2.conf和httpd.conf文件,沒有找到關(guān)于目錄修改的配置,且http.conf為空文件。
二、上網(wǎng)搜索
apache2.conf里并沒有DocumentRoot項,httpd.conf又是空的,www.linuxidc.com因此肯定在其他的文件中。經(jīng)過搜索,發(fā)現(xiàn)在/etc /apache2/sites-enabled/000-default中,里面有這樣的內(nèi)容:
<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服務(wù)也不能正常運(yùn)行了。還好我有一個備用服務(wù)器,經(jīng)查000-default實(shí)際上是一個軟鏈接,指向../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還是有一點(diǎn)小問題的,不過不影響。
下表為空間分配。
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
- 詳解CentOS7安裝配置Apache HTTP Server
- apache You don''t have permission to access /test.php on this server解決方法
- Apache2.4.x版wampserver本地php服務(wù)器如何讓外網(wǎng)訪問及啟用.htaccess
- Win2003+apache+PHP+SqlServer2008 配置生產(chǎn)環(huán)境
- WampServer設(shè)置apache偽靜態(tài)出現(xiàn)404 not found及You don''t have permission to access / on this server解決方法分析
- Apache中啟用Server Status配置示例
- Moon_LServer Linux下一鍵搭建Apache+PHP+MySQL+Zend+PHPMyAdmin+GD庫的軟件
- Apache實(shí)現(xiàn)Web Server負(fù)載均衡詳解(不考慮Session版)
- WampServer下安裝多個版本的PHP、mysql、apache圖文教程
- Linux下Apache HTTP Server 2.4.26安裝教程
相關(guān)文章
Linux殺不死的進(jìn)程之CPU使用率700%解決方法
這篇文章主要給大家介紹了關(guān)于Linux殺不死的進(jìn)程之CPU使用率700%的解決方法,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用Linux系統(tǒng)具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08
Linux安裝Jenkins步驟及各種問題解決(頁面訪問初始化密碼)
這篇文章主要介紹了Linux安裝Jenkins步驟及各種問題頁面訪問初始化密碼,需要的朋友可以參考下2019-12-12
linux禁止ping的實(shí)現(xiàn)實(shí)例
這篇文章主要介紹了linux禁止ping的實(shí)現(xiàn)實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-05-05

