標籤:伺服器 figure enforce water 支援 linu 改名 網域名稱 百度
Apache http server 是開源軟體的傑出代表,基於標準的HTTP網路通訊協定提供網頁瀏覽服務,apache伺服器可以運行在Linux UNIX Windows等多種作業系統平台。Apache的主要特點
- 開放原始碼
- 跨平台應用
- 支援各種Web程式設計語言
- 模組化設計
- 運行非常穩定
- 良好的安全性
環境部署
- redhat6.5系統
- ip地址:192.168.100.101
- 相關軟體包:百度雲
1.查看系統是否安裝httpd服務,如有卸載。
# rpm -q httpdhttpd-2.2.15-29.el6_4.x86_64# yum remove httpd -y
2.建立一個目錄,掛載宿主機上的共用出來的apache軟體包
# mkdir /abc# mount.cifs //192.168.100.3/linux /abc# ls /abc/LAMPapr-1.4.6.tar.gz apr-util-1.4.1.tar.gzhttpd-2.4.2.tar.gz
3.解壓Apache壓縮包到/opt下
# tar zxvf httpd-2.4.2.tar.gz -C /opt# tar zxvf apr-1.4.6.tar.gz -C /opt# tar zxvf apr-util-1.4.1.tar.gz -C /opt
4.將解壓後的包複製到/opt/httpd-2.4.2/srclib下分別改名為apr和apr-util
# cp -R apr-1.4.6/ httpd-2.4.2/srclib/apr# cp -R apr-util-1.4.1/ httpd-2.4.2/srclib/apr-util
5.yum安裝相關環境包
# yum install gcc gcc-c++ make perl pcre-devel expat-devel libxml2-devel -y
6.配置軟體模組
cd /opt/httpd-2.4.2./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most --with-mpm=worker --disable-cgid --disable-cgi
配置資訊
./configure --prefix=/usr/local/apache \ 安裝路徑--enable-so \ 啟動核心--enable-rewrite \ 啟動重寫功能--enable-mods-shared=most \ 模組共用--with-mpm=worker \ 使用者多進程--disable-cgid \ 通用閘道介面--disable-cgi
7.編譯安裝
# make && make install
8.過濾apachectl的# 重新導向儲存到/etc/init.d/httpd中 (啟動指令碼)
# grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd # vi /etc/init.d/httpd 在開頭插入下面 #!/bin/sh # chkconfig:2345 85 15 # description:Apache is a World Wide Web server.
9.給httpd指令碼開啟執行許可權、添加服務
# chmod +x /etc/init.d/httpd //給httpd開啟執行許可權# chkconfig --add httpd //添加httpd服務# chkconfig --list httpd //查看httpd服務# chkconfig --level 35 httpd on //把httpd服務的3 5開啟
10.給httpd.conf 建立一個軟串連 方便管理
# ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf# vim /etc/httpd.confListen:192.168.100.101:80 //修改監聽IP#Listen:80 #ipv6的需要關閉ServerName www.benet.com:80 //修改網域名稱
11.重啟httpd服務、關閉防火牆
# service httpd stop# service httpd star# service iptables stop # setenforce 0
12.修改首頁內容測試
echo "<h1>this is web</h1>" > /usr/local/apache/htdocs/index.html
Apache手工編譯安裝(內附軟體包)