編譯安裝httpd-2.4


編譯安裝httpd-2.4


編譯安裝步驟:


    yum groupinstall "Development Tools" "Server Platform Development" -y  安裝開發環境


    lftp http://archive.apache.org/dist/apr/   下載apr和apr-util

    >mget apr-1.5.2.tar.bz2 apr-util-1.5.3.tar.bz2

    >bye  


    ls

    tar xf apr-1.5.2.tar.bz2


    cd apr-1.5.2

    ./configure --prefix=/usr/local/apr

    make && make install


    ls

    tar xf apr-util-1.5.3.tar.bz2

    cd apr-util-1.5.3

    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 

    make && make install


    apr和apr-util就裝好了。



前提:

安裝開發環境,安裝pcre-devel


    # groupadd -r apache 創建系統組,運行apache的

# useradd -r -g apache apahce 添加一個系統用戶

# yum install pcre-devel -y

# lftp http://httpd.apache.org/download.cgi  這個我下載不下來,說沒有資源,但我可以手動下載,於是用xshell傳輸到linux上了。

# mget httpd-2.4.23.tar.bz2

# tar xf httpd-2.4.23.tar.bz2

# cd httpd-2.4.23


# ./configure --prefix=/usr/local/apache --sysconf=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork

# make && make install


啓動服務:

apachectl


確保80端口沒有其他服務在佔用,否則啓動不起來,套接字是獨佔的。

/usr/local/apache/bin/apachectl 這個命令,不要直接使用apachectl,那是rmp包安裝生成的。

也可以這樣:

vim /etc/profile.d/httpd.sh

export PATH=/usr/local/apache/bin:$PATH  把這個位置放前面

保存退出


[root@web1 ~]# vim /etc/profile.d/httpd.sh

[root@web1 ~]# . /etc/profile.d/httpd.sh

[root@web1 ~]# echo $PATH

/usr/local/apache/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root@web1 ~]# which apachectl

/usr/local/apache/bin/apachectl

[root@web1 ~]#



[root@web1 ~]# apachectl start

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using web1.ams.com. Set the 'ServerName' directive globally to suppress this message


報錯了。。。。

解決方案:

        killall httpd

        cd /etc/httpd24

        vim httpd.conf

            ServerName web1.ams.com:80  把這項啓用起來,改爲自己的服務器名。

        保存退出,


        [root@web1 ~]# apachectl restart

        [root@web1 ~]# ss -tnl

        80端口已經監聽。


        訪問下自己的地址:http://192.168.1.117/

        顯示:it works!








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章