[{"data":1,"prerenderedAt":54},["ShallowReactive",2],{"article-60":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":31,"read_time":14,"comments":14,"cover":32,"relevant":33},60,"解决Nginx自动忽略header包含下划线参数方法","Nginx,Web","该文章记录一次更换服务器后，web环境使用LNMP，部署项目时出现的问题以及解决方法，之前使用的LAMP环境。",12,"最近更换了站点的服务器，web服务环境使用了LNMP（之前使用的是LAMP），在部署项目时发现后端无法获取http请求头中的自定义参数。\n\n原因：\n\nnginx对http请求header name的字符做了限制，默认 `underscores_in_headers 为off`表示如果header name中包含下划线，则忽略掉，部署后就获取不到。\n\n解决方法：\n\n1.在自定义的header信息里不要用下划线，可以用驼峰命名或者其他的符号（如减号-）代替.\n\n2.在nginx里的 nginx.conf文件中配置http的部分添加 ： `underscores_in_headers on`;（默认值是off）\n\n建议使用第一种方法，nginx有这种限制肯定有原因的。\n\n是因为nginx是严格按照http 的标准，头部是不允许出现下划线，所以nginx直接舍弃了带下划线的参数。\n\n",null,0,496,"",1,"2019-07-05 15:14:57","2026-04-19 15:12:21",134,"Nginx",{"id":23,"title":24},59,"Yii2安装使用InfluxDB",{"id":26,"title":27},61,"PHP回调函数call_user_func和call_user_func_array使用",[29],{"id":30,"name":21},36,332,"https:\u002F\u002Ftp.myong.top\u002Fstorage\u002Farticle\u002F41\u002F9b90b419601d3b7855b4df7be19c5e.jpg",[34,39,44,49],{"id":35,"title":36,"create_time":37,"description":38},71,"Nginx反爬虫策略，禁止某些UA抓取网站","2020-03-20 16:59:46","目前网络上的爬虫非常多，有对网站收录有益的，比如百度蜘蛛（Baiduspider），也有不但不遵守robots规则对服务器造成压力，还不能为网站带来流量的无用爬虫，为防止网站有可能会被别人爬，通过配置Nginx, 我们可以拦截大部分爬虫 ",{"id":40,"title":41,"create_time":42,"description":43},66,"Nginx解决访问图片显示404，403问题","2020-04-03 09:02:59","###### 问题描述\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",{"id":45,"title":46,"create_time":47,"description":48},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":50,"title":51,"create_time":52,"description":53},139,"Nginx 性能优化实战指南：从基础配置到高并发压测","2026-04-12 04:07:34","Nginx 是全球使用最广泛的 Web 服务器之一，以高性能、低资源占用著称。但默认配置往往保守，没有发挥出 Nginx 的全部潜力。本文系统梳理 2025 年 Nginx 性能优化的核心配置项，从基础参数调优、Gzip 压缩、缓存策略、安全防护到压测验证，配合完整配置示例，帮你将网站性能提升数倍。",1783431663346]