Apache網站服務器:作爲LAMP架構的前端,是一款功能強大、穩定性好的web服務器程序,該服務器直接面向用戶提供網站訪問,發送網頁、圖片等文件內容。
1:獲取安裝包 創建一個目錄 用來掛載宿主機上共享文件裏的 apache安裝包。
2:然後解壓 httpd 、apr、apr-util 壓縮包 到 /opt 目錄下
3:將目錄下的 apr、apr-util 複製到httpd目錄下的srclib目錄下 並命名爲apr、apr-util
4: 用yum 安裝 gcc gcc-c++ make perl pcre-devel expat-devel libxml2-devel 環境
# mount.cifs //192.168.100.1/gx /gx
# tar xzvf httpd-2.4.2.tar.gz -C /opt
# tar xzvf apr-1.4.6.tar.gz -C /opt (支持Apache上層應用跨平臺,提供底層接口庫)
# tar xzvf apr-util-1.4.1.tar.gz -C /opt
# cp -R apr-1.4.6 /opt/httpd-2.4.2/srclib/apr
# cp -R apr-util-1.4.1 /opt/httpd-2.4.2/srclib/apr-util
# yum install gcc gcc-c++ make perl pcre-devel expat-devel libxml2-devel -y
-
5 :編譯&&編譯安裝
# 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 # make && make install
-
6:過濾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.
-
7:給httpd腳本開啓執行權限、添加服務
# chmod +x /etc/init.d/httpd //給httpd開啓執行權限 # chkconfig --add httpd //添加httpd服務 # chkconfig --list httpd //查看httpd服務 # chkconfig --level 35 httpd on //把httpd服務的3 5開啓
-
8:給httpd.conf 創建一個軟連接 方便管理
# ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf # vim /etc/httpd.conf Listen:192.168.100.111:80 //修改監聽IP ServerName www.yun.com:80 //修改域名
-
9:重啓httpd服務、關閉防火牆
# service httpd stop # service httpd start # service iptables stop # setenforce 0
- 10:編輯 /usr/local/apache/htdocs/index/html
可以修改網頁上的內容
-
11:在瀏覽器上輸入之前 設置的監聽IP