下載httpd-2.2.26.tar.gz(下載地址),執(zhí)行
sudo tar xzfv httpd-2.2.26.tar.gz cd httpd-2.2.26 sudo ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
如果提示如下錯(cuò)誤:
checking for C compiler default output file name... configure: error: C compiler cannot create executables
原因是未安裝libc6-dev ,執(zhí)行
sudo apt-get install build-essential
就ok了。
然后重新執(zhí)行:
sudo ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
未報(bào)錯(cuò),接著執(zhí)行
sudo make sudo make install sudo groupadd apache sudo useradd -g apache apache sudo passwd apache sudo chown -R apache:apache /usr/local/apache2
修改apache的配置文件,執(zhí)行
sudo vi /usr/local/apache2/conf/httpd.conf
找到
User nobody Group #-1
修改成
User apache Group apache
找到
#ServerName www.example.com:80
改為
ServerName *:80
保存!
執(zhí)行命令
sudo /usr/local/apache2/bin/apachectl start
啟動(dòng)apache.
打開瀏覽器,訪問(wèn)http://localhost
如果一切順利,應(yīng)該可以看到apache的測(cè)試頁(yè)面。恭喜你,apache安裝好了!
重啟和關(guān)閉apache服務(wù)的命令分別是:
sudo /usr/local/apache2/bin/apachectl restart
sudo /usr/local/apache2/bin/apachectl stop
掃碼二維碼 獲取免費(fèi)視頻學(xué)習(xí)資料
- 本文固定鏈接: http://www.wangchenghua.com/post/1367/
- 轉(zhuǎn)載請(qǐng)注明:轉(zhuǎn)載必須在正文中標(biāo)注并保留原文鏈接
- 掃碼: 掃上方二維碼獲取免費(fèi)視頻資料
查 看2022高級(jí)編程視頻教程免費(fèi)獲取