CentOS下配置HTTPS访问主机并绑定访问端口号
生活随笔
收集整理的這篇文章主要介紹了
CentOS下配置HTTPS访问主机并绑定访问端口号
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
系統(tǒng)環(huán)境:
Linux: CentOS release 6.5 (Final)LAMP
步驟
1.lamp開(kāi)啟ssl
# yum install openssl mod_ssl -y # 安裝openssl和apache的ssl模塊
2.證書生成的方法
# openssl genrsa -des3 -out server.key 1024 # 生成服務(wù)器私鑰
# openssl req -new -key server.key -out server.csr # 生成服務(wù)器證書請(qǐng)求,并按要求填些相關(guān)證書信息
# openssl x509 -req -days 700 -in server.csr -signkey server.key -out server.cert # 簽證
# /etc/init.d/mysqld restart # 重新啟動(dòng)APACHE
3.配置虛擬主機(jī)文件
# vim /etc/httpd/conf/httpd.conf
添加如下內(nèi)容:
Listen 5123<VirtualHost *:5123>ServerName localhost.localdomainDocumentRoot /etc/httpd/conf/SSLEngine onSSLCertificateFile "/etc/httpd/conf/server.cert"SSLCertificateKeyFile "/etc/httpd/conf/server.key" </VirtualHost>
# semanage port -a -t http_port_t -p tcp 5123 # 為http服務(wù)添加新的端5123
# semanage port -a -t http_port_t -p tcp 443 # 為http服務(wù)添加新的端443
# /sbin/iptables -I INPUT -p tcp --dport 5123 -j ACCEPT # 為http服務(wù)添加新的端5123
# /sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT # 為http服務(wù)添加新的端443
# /etc/init.d/httpd restart # 重新啟動(dòng)APACHE
4.semanage的安裝步驟
# yum provides /usr/sbin/semanage
# yum -y install policycoreutils-python
# semanage port -l | grep http # 驗(yàn)證
總結(jié)
以上是生活随笔為你收集整理的CentOS下配置HTTPS访问主机并绑定访问端口号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Effective Java:对于所有对
- 下一篇: Android仿IOS的Assistiv