摘要:
rewrite模块(ngx_http_rewrite_module) nginx通过ngx_http_rewrite_module模块支持url重写、支持if条件判断,但不支持else。另外该模块需要PCRE支持,应在编译nginx时指定PCRE支持。根据相关变量重定向和选择不同的配置,从一个loc 阅读全文
posted @ 2020-04-26 09:19
罐头1992
阅读(12229)
评论(0)
推荐(0)
摘要:
location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配到所有请求 # 但是正则和最长字符串会优先匹配 [ confi 阅读全文
posted @ 2020-04-26 09:17
罐头1992
阅读(184)
评论(0)
推荐(0)
摘要:
语法规则: location [=|~|~*|^~] /uri/ { … } = 开头表示精确匹配 ^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即可。nginx不对url做编码,因此请求为/static/20%/aa,可以被规则^~ /static/ /aa匹配到(注意是空格)。 阅读全文
posted @ 2020-04-26 09:10
罐头1992
阅读(392)
评论(0)
推荐(0)
摘要:
#nginx进程,一般设置为和cpu核数一样worker_processes 4; #错误日志存放目录error_log /data1/logs/error.log crit; #运行用户,默认即是nginx,可不设置user nginx #进程pid存放位置pid /application/ngi 阅读全文
posted @ 2020-04-26 09:05
罐头1992
阅读(187)
评论(0)
推荐(0)
摘要:
一、简明nginx常用命令 1. 启动 Nginx poechant@ubuntu:sudo ./sbin/nginx 2. 停止 Nginx poechant@ubuntu:sudo ./sbin/nginx -s stop poechant@ubuntu:sudo ./sbin/nginx -s 阅读全文
posted @ 2020-04-26 09:02
罐头1992
阅读(769)
评论(0)
推荐(0)
摘要:
1.安装gcc gcc-c ++(如新环境,未安装请先安装) $ yum install -y gcc gcc-c ++2.安装PCRE库$ cd / usr / local / $ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.3 阅读全文
posted @ 2020-04-26 08:57
罐头1992
阅读(626)
评论(0)
推荐(0)

浙公网安备 33010602011771号