PHP

一次lamp环境配置thinkphp项目的https

2020-03-22  本文已影响0人  江江简书
前言:说来都辛酸,项目还有2天就要上线了,然而就是这个时候https才从阿里上面下来,因为小程序项目要用到https所以被迫要换https,所以入坑,这其中大大小的没有经验让我绞尽心机,但是最后还是解决,

安装

yum -y install mod_ssl
找到ssl.conf文件配置如下面

难题1

.htaccess: <IfModule not allowed here

服务器报500这个错误完全没有很好的方案解决,最后借鉴了别人的ssl.conf和vhost配置如下,初步判断可能这个错误可能是缺少Dirctory导致的

<VirtualHost *:443>     
    DocumentRoot "/data/webapp/server19/michael_france/01-SRC/trunk/public"  
    ServerName 你的域名
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
    SSLHonorCipherOrder on
    SSLCertificateFile "/etc/httpd/cert/xxx.crt"
    SSLCertificateKeyFile "/etc/httpd/cert/xxx.key"
    SSLCertificateChainFile "/etc/httpd/cert/xxx.crt"
    <Directory "/data/webapp/server19/michael_france/01-SRC/trunk/public">
        Options FollowSymLinks ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
   </Directory>
</VirtualHost>
<VirtualHost *:443>     
    DocumentRoot "/data/webapp/flsapi/public"  
    ServerName 你的域名
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
    SSLHonorCipherOrder on
    SSLCertificateFile "/etc/httpd/cert2/xxx.crt"
    SSLCertificateKeyFile "/etc/httpd/cert2/xxx.key"
    SSLCertificateChainFile "/etc/httpd/cert2/xxx.crt"
    <Directory "/data/webapp/flsapi/public">
     Options FollowSymLinks ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
     Require all granted
   </Directory>
</VirtualHost>

vhosts配置如下

<VirtualHost *:80>
    ServerName 和ssl的域名一致
    DocumentRoot "/data/webapp/flsapi/public/"
    SetEnv ENV dev
    <Directory "/data/webapp/flsapi/public/">
        Require all granted
        Options Indexes FollowSymLinks
        Allowoverride All
        DirectoryIndex index.php
    </Directory>
</VirtualHost>
<VirtualHost *:80>
          ServerName 和ssl的域名一致
          DocumentRoot "/data/webapp/server19/michael_france/01-"
          SetEnv ENV dev  //这个是用来区分正式环境和测试环境
<Directory "/data/webapp/server19/michael_france/01-SRC/trunk/public/">
            Require all granted
            Options Indexes FollowSymLinks
            Allowoverride All
             DirectoryIndex index.php
      </Directory>
</VirtualHost>

总结:

上一篇 下一篇

猜你喜欢

热点阅读