CentOS下配置HTTPS访问主机并绑定访问端口号
2015-07-15 16:47
169 查看
系统环境:
Linux: CentOS release 6.5 (Final)LAMP
步骤
1.lamp开启ssl
# yum install openssl mod_ssl -y # 安装openssl和apache的ssl模块2.证书生成的方法
# openssl genrsa -des3 -out server.key 1024 # 生成服务器私钥# openssl req -new -key server.key -out server.csr # 生成服务器证书请求,并按要求填些相关证书信息
# openssl x509 -req -days 700 -in server.csr -signkey server.key -out server.cert # 签证
# /etc/init.d/mysqld restart # 重新启动APACHE
3.配置虚拟主机文件
# vim /etc/httpd/conf/httpd.conf添加如下内容:
Listen 5123 <VirtualHost *:5123> ServerName localhost.localdomain DocumentRoot /etc/httpd/conf/ SSLEngine on SSLCertificateFile "/etc/httpd/conf/server.cert" SSLCertificateKeyFile "/etc/httpd/conf/server.key" </VirtualHost>
# semanage port -a -t http_port_t -p tcp 5123 # 为http服务添加新的端5123
# semanage port -a -t http_port_t -p tcp 443 # 为http服务添加新的端443
# /sbin/iptables -I INPUT -p tcp --dport 5123 -j ACCEPT # 为http服务添加新的端5123
# /sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT # 为http服务添加新的端443
# /etc/init.d/httpd restart # 重新启动APACHE
4.semanage的安装步骤
# yum provides /usr/sbin/semanage# yum -y install policycoreutils-python
# semanage port -l | grep http # 验证
相关文章推荐
- http 响应头里面Content-Length字段详解
- Android OkHttp的Cookie自动化管理
- XMLHttpRequest对象的属性和方法
- 云计算和大数据时代网络技术揭秘(六)LISP协议
- 云计算和大数据时代网络技术揭秘(五)可靠的网络
- 探秘TCP数据包中的PSH标志
- 如何正确打开优衣库试衣间?网络营销最容易掉进的蠢陷阱
- 放开Linux内核对用户进程可打开文件数和TCP连接的限制
- tcp/ip基本概念
- 减少图片HTTP 请求的方案
- AFNetWorking取消当前的网络请求
- android http通信之httpclient
- ios开发网络篇—POST请求(项目中用到的)
- How can you troubleshoot to try to resolve common HTTP errors that occur when working with Lotus Dom
- Volley来实现网络请求
- 宝典——操作系统、数据库和网络
- TCP详解(1):简介与数据包
- CentOS服务器Http压力测试之ab
- Qt提示 "Could not connect to AppWrapper, Please make sure TCP port 12005 is not blocked"解决方法
- http://www.cnblogs.com/kevinGao/archive/2012/05/02/2482117.html