一.httpd-2.2版本安裝及配置
1.安裝httpd-2.2.3
# yun -y install httpd
2.查看httpd安裝生成的文件
# rpm -ql httpd | less
3.啟動(dòng)服務(wù)
# service httpd start
4.開機(jī)自動(dòng)啟動(dòng)服務(wù)
# chkconfig --add httpd
# chkconfig --level 345 httpd on
5.建立測(cè)試頁面
# cd /var/www/html
# vim index.html
6.httpd服務(wù)的配置文件
# cd /etc/httpd/conf/
# cp httpd.conf httpd.conf.bak
7.編輯配置文件
# vim httpd.conf
ServerTokens Major
KeepAlive On
8.修改網(wǎng)站根目錄
DocumentRoot "/web/html"
<Directory "/web/html">
Options none
AllowOverride None
Order deny,allow
Deny from 192.168.0.1 172.16.100.177
<Directory/>
9.檢測(cè)配置文件是否語法正確
# httpd -t
10.linux下使用純文本瀏覽器
# elinks http://ip
11.限定用戶訪問網(wǎng)站
AllowOverride AuthConfig
AuthType Basic
AuthName "Restricted Files"
AuthUserFile "/etc/httpd/conf/htpasswd"
Require valid-user 或 Require user hadoop
12.建立限定用戶文件
# htpasswd -c -m /etc/httpd/conf/htpasswd hadoop
# htpasswd -m /etc/httpd/conf/htpasswd tom
13.重啟服務(wù)
# service httpd restart
14.在電腦瀏覽器上測(cè)試是否設(shè)置成功(限定用戶)
15.基于組限定訪問
AllowOverride AuthConfig
AuthType Basic
AuthName "Restricted Files"
AuthUserFile "/etc/httpd/conf/htpasswd"
AuthGroupFile "/etc/httpd/conf/htgroup"
Require group myusers
16.建立用戶組文件
# vim /etc/httpd/conf/htgroup
myusers: hadoop tom
17.重啟服務(wù)
# service httpd restart
18.htpasswd命令刪除用戶
# htpasswd -D hadoop
19.虛擬主機(jī)的配置
首先要注釋中心主機(jī) DocumentRoot
20.在/etc/httpd/conf.d/目錄下建立虛擬機(jī)配置文件
# vim /etc/httpd/conf.d/virtual.conf
NameVirtualHost 172.16.100.1:80
<VirtualHost 172.16.100.1:80〉
ServerName www.luochen.com
DocumentRoot "/web/luochen"
CustomLog /var/log/httpd/luochen/access_log combined
<Directory "/web/luochen">
Options none
AllowOverride AuthConfig
AuthType Basic
AuthName "Restricted Files"
AuthUserFile "/etc/httpd/conf/htpasswd"
Require valid-user 或 Require user hadoop
<Directory/>
</VirtualHost>
<VirtualHost 172.16.100.1:80〉
ServerName www.luo.com
DocumentRoot "/web/luo"
CustomLog /var/log/httpd/luo/access_log combined
<Directory "/web/luo">
Options none
AllowOverride None
Order deny,allow
Deny from 192.168.0.1 172.16.100.177
<Directory/>
</VirtualHost>
21.編輯windows下的hosts文件
172.16.100.1 www.luochen.com
172.16.100.1 www.luo.com
22.安裝mod_ssl模塊(htppd基于rpm包安裝時(shí))
# yum -y install mod_ssl
23.查看mod_ssl安裝生成那些文件
# rpm -ql mod_ssl
24.自建CA (在172.16.100.10主機(jī)上)
# cd /etc/pki/CA
# (umask 077; openssl genrsa -out private/cakey.pem 2048; )
# vim /etc/pki/tls/openssl.cnf
[ req_distinguished_name ]
countryName_Default = CN
setOrProvinceName_default = HB
localityName_default = WUHAN
0.organizationName_default = COLLEGE
organizationalUnitName_default = Tech
25.# openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650
hostname ca.luochen.com
26.編輯openssl文件
dir = /etc/pki/CA
27.創(chuàng)建相應(yīng)的目錄文件
# mkdir certs newcerts crl
# touch index.txt
# echo 01 > serial
28.在httpd服務(wù)目錄下創(chuàng)建ssl目錄(在172.16.100.1主機(jī)上)
# mkdir /etc/httpd/ssl
# (umask 077; openssl genrsa 2048 > httpd.key) //生成密鑰
# openssl req -new -key httpd.key -out httpd.csr //生成證書頒發(fā)請(qǐng)求
hostname === ServerName
# scp http.csr 172.16.100.10:/tmp //將證書頒發(fā)請(qǐng)求復(fù)制到服務(wù)器端
29.在172.16.100.10主機(jī)上
# openssl ca -in /tmp/httpd.csr -out /tmp/httpd.crt -daya 3650 //生成證書
# cat /etc/pki/CA/serial //顯示02即成功
30.將證書復(fù)制到客戶端主機(jī)上(172.16.100.1)
# scp 172.16.100.10/tmp/httpd.crt ./ //將證書復(fù)制到客戶端主機(jī)上
31.刪除tmp目錄下所有文件
# vim rm -rf ./*
32.編輯/etc/httpd/conf.d/ssl.conf 文件(172.16.100.1)
# vim /etc/httpd/conf.d/ssl.conf
<VirtualHost 172.16.100.1:443>
ServerName www.luochen.com
DocumentRoot "/web/www/luochen"
SSLCertificateFile /etc/httpd/ssl/httpd.crt
SSLCertificateKeyFile /etc/httpd/ssl/httpd.key
</VirtualHost>
33.重啟httpd服務(wù)器
# service httpd restart
34.將CA的證書復(fù)制到windows主機(jī)上
/etc/pki/CA/cacert.pem //在172.16.100.10
35.在Windows主機(jī)上對(duì)證書進(jìn)行重命名
cacert.pem cacert.crt
36.雙擊安裝證書
37.最后在瀏覽器用https協(xié)議訪問 驗(yàn)證
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)站名稱:httpd-2.2版本安裝及配置-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://jinyejixie.com/article46/dphshg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、服務(wù)器托管、域名注冊(cè)、網(wǎng)站導(dǎo)航、外貿(mào)建站、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容