[{"data":1,"prerenderedAt":62},["ShallowReactive",2],{"article-66":3},{"code":4,"msg":5,"data":6,"count":14},200,"查询成功",{"id":7,"title":8,"keywords":9,"description":10,"category_id":11,"content":12,"body_html":13,"thumb_up":14,"clicks":15,"sort":14,"remark":16,"status":17,"is_open":17,"is_deleted":14,"is_top":14,"is_recommend":14,"create_time":18,"update_time":19,"image_id":20,"url":13,"member_id":14,"cate_name":21,"prev":22,"next":25,"tags":28,"words":37,"read_time":38,"comments":39,"cover":40,"relevant":41},66,"Nginx解决访问图片显示404，403问题","Nginx,服务器","###### 问题描述\n\n项目中所有的资源放在`\u002Fwww\u002Fjianshu\u002Fpublic\u002Fstorage`中,希望通过url的方式将其展示出来，如下是配置\n\n```bash\neg: http:\u002F\u002Fdemo.test.com\u002Fstorage\u002Fimg\u002F1.png\n```\n\n```bash\nserver\n{\n    listen 80;\n    listen [::]:80;\n    server_name demo.test.com;\n    index index.php index.html in",12,"###### 问题描述\n\n项目中所有的资源放在`\u002Fwww\u002Fjianshu\u002Fpublic\u002Fstorage`中,希望通过url的方式将其展示出来，如下是配置\n\n```bash\neg: http:\u002F\u002Fdemo.test.com\u002Fstorage\u002Fimg\u002F1.png\n```\n\n```bash\nserver\n{\n    listen 80;\n    listen [::]:80;\n    server_name demo.test.com;\n    index index.php index.html index.htm default.php default.htm default.html;\n    root \u002Fwww\u002Ftest\u002Fpublic;\n    \n    #PHP-INFO-START  PHP引用配置，可以注释或修改\n    include enable-php-74.conf;\n    #PHP-INFO-END\n    \n    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效\n    include \u002Fserver\u002Fvhost\u002Frewrite\u002Fdemo.test.com.conf;\n    \n    #REWRITE-END\n    if (!-e $request_filename) {\n       rewrite  ^(.*)$  \u002Findex.php?s=\u002F$1  last;\n       break;\n    }\n    \n    #禁止访问的文件或目录\n    location ~ ^\u002F(\\.user.ini|\\.htaccess|\\.git|\\.svn|\\.project|LICENSE|README.md)\n    {\n        return 404;\n    }\n    \n    #一键申请SSL证书验证目录相关设置\n    location ~ \\.well-known{\n        allow all;\n    }\n    \n    location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$\n    {\n        expires      30d;\n        error_log off;\n        access_log \u002Fdev\u002Fnull;\n    }\n    \n    location ~ .*\\.(js|css)?$\n    {\n        expires      12h;\n        error_log off;\n        access_log \u002Fdev\u002Fnull; \n    }\n    access_log  \u002Fwwwlogs\u002Fdemo.test.com.log;\n    error_log  \u002Fwwwlogs\u002Fdemo.test.com.error.log;\n}\n```\n\n按照如上配置访问时，返回404\n\n###### 解决问题\n\n新增资源访问配置\n\n```bash\nlocation ^~ \u002Fstorage\u002F {\n\talias  \u002Fwww\u002Ftest\u002Fpublic\u002Fstorage\u002F;\n}\n```\n\n##### 总结\n\nroot响应的路径：配置的路径（root指向的路径）+完整访问路径(location的路径）+静态文件\n\nalias响应的路径：配置路径+静态文件(去除location中配置的路径)\n\n\n",null,0,598,"",1,"2020-04-03 09:02:59","2026-04-19 15:05:32",140,"Nginx",{"id":23,"title":24},65,"Laravel5多库使用事务失效问题解决",{"id":26,"title":27},67,"PHP面试题之代码设计类",[29,31,34],{"id":30,"name":21},36,{"id":32,"name":33},35,"服务器",{"id":35,"name":36},32,"web",850,2,10,"https:\u002F\u002Ftp.myong.top\u002Fstorage\u002Farticle\u002Fa6\u002Fb893ca219d1ce6b4b96a91423a9b3f.jpg",[42,47,52,57],{"id":43,"title":44,"create_time":45,"description":46},71,"Nginx反爬虫策略，禁止某些UA抓取网站","2020-03-20 16:59:46","目前网络上的爬虫非常多，有对网站收录有益的，比如百度蜘蛛（Baiduspider），也有不但不遵守robots规则对服务器造成压力，还不能为网站带来流量的无用爬虫，为防止网站有可能会被别人爬，通过配置Nginx, 我们可以拦截大部分爬虫 ",{"id":48,"title":49,"create_time":50,"description":51},76,"Nginx配置优化","2019-12-29 14:37:11","\n###### 开启高效传输模式\n\n```bash\nhttp {\n\tinclude       mime.types;\n\t...\n\tdefault_type  application\u002Foctet-stream;\n\t...\n\tsendfile   on;\n\ttcp_nopush on;\n}\n#... 配置省略项\n```\n\n参数说明\n\n```bash\ninclude mime.types; #媒体类型,include 只是一个在当前文件中包含另一个文件内容的指令\ndefault_type appli",{"id":53,"title":54,"create_time":55,"description":56},60,"解决Nginx自动忽略header包含下划线参数方法","2019-07-05 15:14:57","该文章记录一次更换服务器后，web环境使用LNMP，部署项目时出现的问题以及解决方法，之前使用的LAMP环境。",{"id":58,"title":59,"create_time":60,"description":61},139,"Nginx 性能优化实战指南：从基础配置到高并发压测","2026-04-12 04:07:34","Nginx 是全球使用最广泛的 Web 服务器之一，以高性能、低资源占用著称。但默认配置往往保守，没有发挥出 Nginx 的全部潜力。本文系统梳理 2025 年 Nginx 性能优化的核心配置项，从基础参数调优、Gzip 压缩、缓存策略、安全防护到压测验证，配合完整配置示例，帮你将网站性能提升数倍。",1783431662175]