Apache httpd服務——安裝

yum安裝

安裝:html

yum -y install httpd

配置文件:apache

/etc/httpd/conf/httpd.conf

 和 瀏覽器

/etc/httpd/conf.d/*.conf 

下全部以.conf結尾的文件bash

服務控制:測試

systemctl start|restart|stop|reload httpd

站點網頁文檔根目錄:rest

/var/www/html

模塊文件路徑:日誌

/usr/lib64/httpd/modules

主程序文件:code

/usr/sbin/httpd

主進程文件:htm

/run/httpd/httpd.pid

日誌文件目錄:blog

/var/log/httpd

離線幫助文檔包:

yum -y install httpd-manual

重啓服務後在瀏覽器中輸入 http://IP/manual/ 便可使用

編譯安裝

系統環境:CentOS6.9

arp版本:1.6 # wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.3.tar.gz

arp-util版本:1.6 # wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

httpd版本:2.4 # wget http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.33.tar.gz

​ 1)安裝須要的包

~]# yum -y groupinstall "Development tools"
~]# yum -y install openssl-devel expat-devel pcre-devel

​ 2)配置編譯安裝

~]# tar xf apr-1.6.3.tar.gz
~]# tar xf apr-util-1.6.1.tar.gz
~]# tar xf httpd-2.4.33.tar.gz
~]# cp -a apr-util-1.6.1 httpd-2.4.33/srclib/apr-util
~]# cp -a apr-1.6.3 httpd-2.4.33/srclib/apr
~]# cd httpd-2.4.33
httpd-2.4.33]# ./configure --prefix=/data/httpd24 \
 --enable-so \
 --enable-ssl \
 --enable-cgi \
 --enable-rewrite \
 --with-zlib \
 --with-pcre  \
 --with-included-apr \
 --enable-modules=most \
 --enable-mpms-shared=all \
 --with-mpm=prefork
httpd-2.4.33]# make -j 4 && make install

​ 3)配置環境變量

~]# echo 'export PATH=/data/httpd24/bin:$PATH' > /etc/profile.d/httpd.sh
~]# echo 'MANPATH /data/httpd24/man' >> /etc/man.config
~]# source /etc/profile.d/httpd.sh
~]# source /etc/man.config

4)啓動服務並測試

~]# apachectl start
相關文章
相關標籤/搜索