phpstudy(Linux)开启https访问:分两步进行,操作前自备SSL申请到的证书。
1、修改配置文件
修改/usr/local/phpstudy/vhost/apache/ports.conf文件:
Listen 80
Listen 443
2、修改/usr/local/phpstudy/vhost/apache/ip_80.conf文件,在文件最后添加一个443端口的配置:
<VirtualHost *:443>
DocumentRoot "/www/admin/www.lingk.club_80/wwwroot/"
ServerName "www.lingk.club"
#############301重定向
#RedirectMatch permanent ^/(.*)
#############强制SSL
#RewriteEngine on
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL
SSLCertificateFile /usr/local/phpstudy/soft/apache/httpd-2.4.39/conf/2_www.lingk.club.crt
SSLCertificateKeyFile /usr/local/phpstudy/soft/apache/httpd-2.4.39/conf/3_www.lingk.club.key
SSLCACertificateFile /usr/local/phpstudy/soft/apache/httpd-2.4.39/conf/1_root_bundle.crt
#############防盗链
#############流量限制
#######防火墙配置
#############日志
CustomLog "|/usr/local/phpstudy/system/module/rotatelogs /www/admin/localhost_80/log/apache_access_%Y-%m-%d.log 86400 480" combined_with_cookie
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html
##############处理PHP
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:7380"
</FilesMatch>
<Directory "/www/admin/www.lingk.club_80/wwwroot/">
DirectoryIndex index.php index.html error/index.html
AllowOverride All
</Directory>
</VirtualHost>
成果图: