1. 程式人生 > >centos6安裝apache2.2

centos6安裝apache2.2

iptable pre 下載 art cap pac mine 主機ip inf

1. 從https://mirrors.tuna.tsinghua.edu.cn/apache/httpd下載httpd包  執行命令  wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.2.32.tar.gz 技術分享

  技術分享

2. 解壓到本地   技術分享 3. 進入到 httpd-2.2.32目錄  執行./configure --prefix=/usr/local/apache2 --sysconfdir=/usr/local/etc/httpd   技術分享 4. 執行 make 命令 5. 執行make install 命令,安裝完成 6. 進入到apache安裝路徑 /usr/local/apache2/bin ,執行啟動腳本
./apachectl start   技術分享 註意事項: 1. 啟動之前檢查80端口是否開啟   netstat -tan   技術分享

2. 檢查防火墻配置是否開啟80端口

  技術分享

  重啟防火墻

  service iptables restart

3. 如果啟動中報錯 :

  httpd: apr_sockaddr_info_get() failed for captian2(主機名)

  httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName

  方法 (1):

  設置 /usr/local/etc/http2/httpd.conf 中的ServerName 為 ServerName localhost:80

  技術分享

  技術分享

  方法(2) 

  在 /etc/hosts 文件中添加自己的主機名,如 127.0.0.1 captain2 

啟動之後,可以在瀏覽器中輸入主機ip地址,即可訪問apache頁面

  技術分享

centos6安裝apache2.2