![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Nginx
majinbo111
这个作者很懒,什么都没留下…
展开
-
ubuntu18.04 nginx: [emerg] unknown directive "echo" in /etc/nginx/nginx.conf
ubuntu18.04 nginx: [emerg] unknown directive “echo” in /etc/nginx/nginx.conf解决办法1:sudo apt-get install nginx-extras解决办法2:sudo apt-get install libnginx-mod-http-echo原创 2019-03-20 10:40:58 · 2899 阅读 · 0 评论 -
nginx map module
官方文档http://nginx.org/en/docs/http/ngx_http_map_module.html#mapnginx map 案例http { map $http_user_agent $agent { ~curl curl; ~*chrome chrome; } server { listen 8...原创 2019-03-20 10:56:56 · 243 阅读 · 0 评论 -
Response Header hostname
问题:如何使得一个链接返回时,Response Header 展示 hostname呢?解答:利用 more_set_headers 模块,如下。server {#xxxxmore_set_headers ‘X-Node: $hostname’;#xxxx}more_set_headers 属于nginx的 headers-more-nginx-module,详细介绍:https:/...原创 2019-04-10 17:14:34 · 495 阅读 · 0 评论 -
nginx输出变成utf8编码
如何 nginx输出变成utf8编码 ?设置如下:location / { default_type 'application/x-javascript;charset=utf-8'; #吧啦吧啦吧啦巴啦啦}注意:default_type 多值使用 “;”分割,并且值需使用单引号’'包起来...原创 2019-04-10 17:19:20 · 4052 阅读 · 0 评论 -
ngx.var与ngx.ctx的区别
ngx.varngx.var 需预定义方可使用, 一般都写在 ngx 或 openresty 的conf 内 ngx.var;在conf内可以使用set 方式创建变量;ngx.var 可以定义在location内,也可以定义在server 内;在lua 代码使用时,需要 ngx.var.xxx 引用;ngx.var.xxx = nil 表示删除。server { ...原创 2019-04-09 13:49:45 · 14111 阅读 · 0 评论 -
nginx同级域名下的文件转发(代理访问)
a 文件转发 b 文件location = /a.php { proxy_pass http://127.0.0.1/b.php;}#此处必须是等于哈, 不能是模糊匹配,否则会直接到下边的 location 里去location ~ \.php$ { root /home/q/www/zt.dujia.qunar.com/htdocs; ...原创 2019-05-16 15:57:18 · 605 阅读 · 0 评论 -
nginx location
ContentFor exampleReferenceFor examplelocation = / { [ configuration A ]}location / { [ configuration B ]} location /documents/ { [ configuration C ]}location ^~ /images/ { ...原创 2019-06-05 20:28:02 · 171 阅读 · 0 评论 -
User-agent judgement of mobile devices
contentnginxphpnginxif ( $http_user_agent ~* "iPhone|Android|Opera|BlackBerry|hpwOS|SymbianOS|Windows Phone OS" ) { //do something}php<?php$str = 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 li...原创 2019-06-04 14:49:06 · 503 阅读 · 0 评论