蒦嗳伱 发表于 2018-11-18 07:27:32

apache配置https-11180389

  apache配置https
  原文链接:https://www.cnblogs.com/ccccwork/p/6529367.html
  1.安装软件
  yum -y install httpd openssl mod_ssl
  2.建立服务器秘钥
  mkdir /etc/httpd/crts #建立存放证书目录
  cd /etc/httpd/crts
  openssl genrsa -out server.key 1024
  3.建立服务器公钥,随便填写提问的内容
  openssl req -new -key server.key -out server.csr
  4.建立服务器证书
  openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
  5.修改配置文件
  vim /etc/httpd/conf/httpd.conf
  添加下面代码到最后
  RewriteEngine on #开启地址重写
  RewriteCond %{HTTPS} !=on
  RewriteRule ^(.*) https://%{SERVER_NAME}$1 #访问任何内容自动转发到https
  6.修改ssl.conf(443虚拟主机)
  vim /etc/httpd/conf.d/ssl.conf
  SSLCertificateKeyFile /etc/httpd/crts/server.key #私钥位置
  SSLCertificateFile /etc/httpd/crts/server.crt #证书位置
  7.启动服务
  systemctl start httpd 或 service httpd start
  8.直接在浏览器输入ip即可访问,提示不安全则 继续访问

页: [1]
查看完整版本: apache配置https-11180389