国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Apache > 正文

【只需3步】源碼手動安裝Apache以及配置(親測可行)

2024-08-27 18:29:17
字體:
供稿:網(wǎng)友
【只需3步】源碼手動安裝Apache以及配置(親測可行)

作者小波/QQ463431476歡迎轉(zhuǎn)載!

redhat6采用centos yum源。

第一步下載apache依賴的軟件包并安裝

安裝 aPR下載地址:http://apr.apache.org/download.cgi

解壓包:tar -jxvf apr-1.5.0.tar.bz2 注意:這里的包的格式是tar.bz2格式,如果是.tar格式的用 tar -zxvf +包的名字 命令解壓。

進入該包的文件夾內(nèi),依次執(zhí)行以下命令:

./configure --prefix=/work/installed/apr (注意:configure安裝的文件夾目錄可以自己定義)

make

make install

安裝 apr-util下載地址:http://apr.apache.org/download.cgi解壓包: tar -jxvfapr-util-1.5.3.tar.bz2

進入該文件夾并依次執(zhí)行:

./configure --prefix=/work/installed/apr-util --with-apr=/work/installed/apr

make

make install

安裝 pcre 下載地址:http://pcre.org/解壓包:tar -jxvf pcre-8.35.tar.bz2

./configure --prefix=/work/installed/pcre

make

make install

注意:如果在安裝 pcre 時,遇到問題:configure: error: You need a C++ compiler for C++ support.Ubuntu的解決方法sudo apt-get install build-essential

redhat6/centos6解決方法:yum安裝包即可:yum install gcc gcc-c++ kernel-devel

第二步安裝Apache并配置:

安裝:

下載地址:http://httpd.apache.org/解壓:tar -jxvfhttpd-2.4.9.tar.bz2

進入解壓后的文件內(nèi)并執(zhí)行:

./configure --prefix=/work/installed/apache --with-apr=/work/installed/apr --with-apr-util=/work/installed/apr-util --with- pcre=/work/installed/pcre --enable-module=shared

其中--enable-module=shared表示Apache可以動態(tài)的加載模塊,為以后安裝php鋪墊。

make

make install

注意:如果安裝錯誤,想重新裝的話,先刪除安裝的文件夾,然后在解壓后的文件夾內(nèi)執(zhí)行清除編譯:make clean all

第三步配置Apache:

修改配置文件,如果不修改的話就啟動了apache服務(wù)的話就會出現(xiàn)問題:AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message解決方法:

在安裝的目錄下修改文件:

命令:vim/work/installed/apache/conf/httpd.conf 把: # ServerName www.example.com:80改為:ServerName localhost:80

然后也可以配置自己的發(fā)布主頁目錄:

同時也可以添加php的主頁:

如果 /etc/下有hosts文件的話修改:

修改文件: vi /etc/hosts

在后面輸入:192.168.8.119 server.example.com

ip地址改成自己的ip就行了。

啟動apache服務(wù):

輸入命令:/work/installed/apache/bin/apachectl start

開機自動啟動:vim etc/rc.local添加:/work/installed/apache/bin/apachectl start這里是apache的安裝目錄里面的配置文件,讓它開機自動啟動就行啦!

如果不行的話關(guān)閉防火墻:iptables -F

輸入IP地址可以看到:it works!

但是這種情況必須關(guān)閉防火墻,所以需要配置防火墻:

打開iptables的配置文件:vi /etc/sysconfig/iptables

添加一條80端口:(如果自己自定義端口的話,填寫自己的端口)

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

另外一篇yum安裝Apache以及Apache的配置,僅僅提供參考:

http://www.CUOXin.com/xiaobo-linux/p/4631675.html


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄂伦春自治旗| 察雅县| 凌云县| 山东省| 镇远县| 松潘县| 新蔡县| 托里县| 岳池县| 鹤庆县| 清涧县| 达尔| 合水县| 黄龙县| 宝清县| 邹平县| 五家渠市| 济阳县| 环江| 宁强县| 凉城县| 吉水县| 香港 | 建平县| 鄂伦春自治旗| 琼中| 尚义县| 高青县| 黑水县| 白银市| 恩平市| 浮山县| 高平市| 兴城市| 广河县| 洛隆县| 通辽市| 新营市| 张家界市| 平遥县| 镇平县|