xampp 开启gzip压缩

首先编辑php.ini,修改zlib.output_compression 为On

然后编辑httpd.conf,取消注释以下两个模块

LoadModule deflate_module modules/mod_deflate.so
LoadModule filter_module modules/mod_filter.so

接下来在httpd.conf文件最下面加入:

SetOutputFilter DEFLATE 

# Set the path to the directory where you wish to apply the gzip compression
# Usually you would like to apply that to the entire htdocs folder, but you can change it
<Directory "C:/xampp/htdocs">  
    <IfModule mod_deflate.c>
        # Add any file type you want
        AddOutputFilterByType DEFLATE text/html
    </IfModule>
</Directory> 

C:/xampp/htdocs为你要开启gzip压缩的web目录,改为你自己的目录即可

开启之后,我的网站首页打开速度对比

加载内容和时间减少一半

xampp 网站开启https

首先申请ssl证书

https://freessl.cn/

选择亚洲诚信,可以申请一年证书,然后选择浏览器生成,接着验证dns,添加一个txt dns记录就行了

验证完后下载证书

编辑apache虚拟主机配置文件,添加

<VirtualHost *:443>
SSLEngine on
SSLCertificateFile C:/Users/Administrator/Desktop/zuoridangnian.com/full_chain.crt
SSLCertificateKeyFile C:/Users/Administrator/Desktop/zuoridangnian.com/private.key
DocumentRoot "C:/xampp/htdocs/wp/"
ServerName zuoridangnian.com
</VirtualHost>

full_chain.crt是full_chain.pem文件的第一个