mac xampp php ssl,Linux系统 xampp环境https SSL证书设置

准备

从腾讯云后台SSL证书管理里下载证书

1

49bea73651fa1f7674d7bfd766e1f0ae.png

一、上传文件

解压出来以后有三个文件:

30853f4f067780e9421136516dcc3aa0.png1_root_bundle.crt

2_www.xxxxx.com.crt

3_www.xxxxx.com.key

将1_root_bundle.crt文件上传到/opt/lampp/etc目录下

将2_www.xxxxx.com.crt文件上传到/opt/lampp/etc/ssl.crt目录下

将3_www.xxxxx.com.key文件上传到/opt/lampp/etc/ssl.key目录下

二、编辑httpd-ssl.conf文件vi /opt/lampp/etc/extra/httpd-ssl.conf

找到

更改成以下#   General setup for the virtual hostDocumentRoot "/opt/lampp/htdocs"ServerName www.example.com:443ServerAdmin you@example.comErrorLog "/opt/lampp/logs/error_log"TransferLog "/opt/lampp/logs/access_log"#   SSL Engine Switch:#   Enable/Disable SSL for this virtual host.SSLEngine on#   Server Certificate:#   Point SSLCertificateFile at a PEM encoded certificate.  If#   the certificate is encrypted, then you will be prompted for a#   pass phrase.  Note that a kill -HUP will prompt again.  Keep#   in mind that if you have both an RSA and a DSA certificate you#   can configure both in parallel (to also allow the use of DSA#   ciphers, etc.)#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)#   require an ECC certificate which can also be configured in#   parallel.SSLCertificateFile "/opt/lampp/etc/ssl.crt/2_www.xxxxx.com.crt"#   Server Private Key:#   If the key is not combined with the certificate, use this#   directive to point at the key file.  Keep in mind that if#   you've both a RSA and a DSA private key you can configure#   both in parallel (to also allow the use of DSA ciphers, etc.)#   ECC keys, when in use, can also be configured in parallelSSLCertificateKeyFile "/opt/lampp/etc/ssl.key/3_www.xxxxx.com.key"#   Server Certificate Chain:#   Point SSLCertificateChainFile at a file containing the#   concatenation of PEM encoded CA certificates which form the#   certificate chain for the server certificate. Alternatively#   the referenced file can be the same as SSLCertificateFile#   when the CA certificates are directly appended to the server#   certificate for convenience.SSLCertificateChainFile "/opt/lampp/etc/1_root_bundle.crt"

三、强制跳转到HTTPSvi /opt/lampp/etc/httpd.conf

找到DocumentRoot "/opt/lampp/htdocs"

更正为DocumentRoot "/opt/lampp/htdocs"

#

# Possible values for the Options directive are "None", "All",

# or any combination of:

#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

#

# Note that "MultiViews" must be named *explicitly* --- "Options All"

# doesn't give it to you.

#

# The Options directive is both complicated and important.  Please see

# http://httpd.apache.org/docs/trunk/mod/core.html#options

# for more information.

#

#Options Indexes FollowSymLinks

# XAMPP

Options Indexes FollowSymLinks ExecCGI Includes    #

# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

#   Options FileInfo AuthConfig Limit

#

#AllowOverride None

# since XAMPP 1.4:

AllowOverride All

#

# Controls who can get stuff from this server.

#

Require all granted    #新增内容

RewriteEngine on

RewriteCond %{SERVER_PORT} !^443$    RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

四、重启xampp/opt/lampp/lampp restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值