阿里云 Centos 7安装PHP7 配置LNMP

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wanghao725/article/details/51580834

1、安装教程:
http://www.thinkcmf.com/topic/topic/index/id/351.html

2、增加文件解析
修改文件:/etc/nginx/conf.d/default.conf;
index index.php index.html index.htm;

3、测试网页性能工具:
https://developers.google.com/speed/pagespeed/insights/
经测试,需要开启 gzip、启用浏览器缓存
开启gzip,修改 /etc/nginx/nginx.conf 添加:

    gzip  on;
    gzip_comp_level  2;    # 压缩比例,比例越大,压缩时间越长。默认是1
    gzip_types    text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml;     # 哪些文件可以被压缩
    gzip_disable  "MSIE [1-6]\.";     # IE6无效

4、开启静态文件浏览器缓存:
修改文件:/etc/nginx/conf.d/default.conf;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$
           {
                 expires      30d;
           }

    location ~ .*\.(js|css)?$
           {
                 expires      7d;
           }

5、开启 opCache(重要!性能增加 70%)
http://www.tuicool.com/articles/NjmQNj6

猜你喜欢

转载自blog.csdn.net/wanghao725/article/details/51580834