linux編譯安裝apache

下載一個Edit with Notopad++
www.apache.org 官網下載 apr
Pcre.org 官網下載 pcre 而後去到http: //ftp.pcre.org/pub/pcre
httpd.apache.org 官網下載 apache
例子:
#ll →apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz pcre-8.40.tar.gz http-2.4.25.tar.gz
#tar zxf apr-1.5.2.tar.gz
#cd apr-1.5.2
#./configure --prefix=/usr/local/apr
#make && make install
#tar zxf apr-util-1.5.4.tar.gz
#cd apr-util-1.5.4
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make && make install →安裝失敗就要安裝expat開發庫(
#yum install expat-devel -y)
#tar zxf pcre-8.40.tar.gz
#cd pcre-8.40
#./configure --prefix=/usr/local/pcre && make && make install
#tar zxf http-2.4.25.tar.gz -C /usr/src
#cd /usr/src/http-2.4.25
#./configure --prefix=/usr/local/apache --sysconfdir=/etc --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
#make -j 4 && make install
#cd
#firewall-cmd --permanent --add-service=http
#firewall-cmd --reload
#setenforce 0
#hostname →hyj
#vim /etc/hosts
#192.168.163.106 hyj #在hosts裏面新添加一橫
#cat /etc/hosts
#cd
#ln -s /usr/local/apache/bin/* /usr/sbin/
#httpd -t 檢查配置文件語法
#vim /etc/http.conf
#/ServerName www.example.com:80 這橫是系統裏面,找到這橫在後面添加
ServerName www.hyj.com
#wq
#httpd -t
#httpd -k start →打開80端口
#netstat -anlpt |grep httpd
#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#vim /etc/init.d/httpd
#chkconfig: 345 85 15
#description: Activates/Deactivates Apache Web Server
#wq!
#chkconfig --add httpd 添加系統服務
#chkconfig --list httpd →查看開放端口號
能夠用window 系統瀏覽器 192.168.163.106
打開windows系統→去到C盤→windows文件夾→system32文件夾→drivers→etc→用記事本編輯hosts文件(新添加一橫)html

如今能夠經過匿名去反問了
打開windows 系統瀏覽器
www.hyj.comapache

Httpd.conf
(通常在etc下面) DocumentRoot(這個單詞查看我網站主目錄) 「/var/www/html」
Listen (查看監聽端口號)80
主機名稱 域名訪問站點
ServerName www.hyj.com:80
默認主頁 DirectoryIndex index.html
查看服務站的根 「/etc/httpd」vim

相關文章
相關標籤/搜索