随笔分类 -  Nginx

nginx 反向代理注意
摘要:1. Nginx中正则捕获组在proxy_pass中不可用 有一个需求, 根据不同的路径代理到后端 问题出在 $1 这个正则捕获组上。在 Nginx 中,正则表达式中的捕获组是根据 () 定义的,但这个捕获组只在 location 内部有效,并且不会传递到 proxy_pass 中。 所以当你在 p 阅读全文

posted @ 2024-03-18 12:09 正义的伙伴! 阅读(39) 评论(0) 推荐(0) 编辑

禁用通过域名直接访问页面
摘要:# nginx 禁用通过域名直接访问页面 参考 https://www.codedodle.com/disable-direct-ip-access-nginx.html ```conf server { listen 80 default_server; # 下面两行, 需要 按照 ssl_rej 阅读全文

posted @ 2023-08-08 12:47 正义的伙伴! 阅读(39) 评论(0) 推荐(0) 编辑

nginx location 匹配
摘要:root location中root指定的只是相对路径,需要和路径结合起来映射地址,比如 location ^~/static/ { ## 这里的root需要和路径结合使用,即是映射的文件位置为 /usr/alyingboy/static root /usr/alyingboy/; index in 阅读全文

posted @ 2022-11-02 15:38 正义的伙伴! 阅读(241) 评论(0) 推荐(0) 编辑

http 协议添加用户名密码
摘要:如下所示: http://username:password@localhost/loki/api/v1/push 阅读全文

posted @ 2021-08-23 17:59 正义的伙伴! 阅读(1250) 评论(0) 推荐(0) 编辑

nginx 直接返回文本或json
摘要:有些时候请求某些接口的时候需要返回指定的文本字符串或者json字符串,如果逻辑非常简单或者干脆是固定的字符串,那么可以使用nginx快速实现,这样就不用编写程序响应请求了,可以减少服务器资源占用并且响应性能非常快 先看返回固定的文本和json,都是在server中配置location拦截即可,配置示 阅读全文

posted @ 2021-06-22 18:11 正义的伙伴! 阅读(1973) 评论(0) 推荐(0) 编辑

nginx alias 和 root
摘要:上周四,有用户反映线上app中的的某个网页打不开,返回404,地址类似:http://xxx.xxx.com/projectContext/appWeb/page/device/deviceList.html 背景:由于之前后端项目的重构,所有的请求路径,后端服务器已经不支持/projectCont 阅读全文

posted @ 2021-06-09 10:43 正义的伙伴! 阅读(252) 评论(0) 推荐(0) 编辑

nginx if 判断
摘要:一、if语句中的判断条件(nginx) 1、正则表达式匹配: ==:等值比较; ~:与指定正则表达式模式匹配时返回“真”,判断匹配与否时区分字符大小写; ~*:与指定正则表达式模式匹配时返回“真”,判断匹配与否时不区分字符大小写; !~:与指定正则表达式模式不匹配时返回“真”,判断匹配与否时区分字符 阅读全文

posted @ 2021-06-09 10:30 正义的伙伴! 阅读(4600) 评论(0) 推荐(0) 编辑

try_files 命令
摘要:vue router history 模式 nginx 配置 : try_files uriuri/ /index.html 阅读全文

posted @ 2021-06-02 13:58 正义的伙伴! 阅读(276) 评论(0) 推荐(0) 编辑

nginx 正则匹配配置
摘要:nginx location正则写法 示例: # 如果 url 含有 . , 并且 不以 do 或 action 结尾,则匹配成功。 location ~ .*\.(?!(do|action)$) { root /demo/code/webroot; } ^~ 标识符匹配后面跟-一个字符串。匹配字符 阅读全文

posted @ 2020-07-09 14:36 正义的伙伴! 阅读(16988) 评论(0) 推荐(1) 编辑

nginx 密码访问
摘要:https://tool.oschina.net/htpasswd 加密算法选择 md5,nginx 在明文模式下,无法使用,原因未知 阅读全文

posted @ 2020-07-03 09:08 正义的伙伴! 阅读(262) 评论(0) 推荐(0) 编辑

nginx 编译安装,问题
摘要:# 编译 ./configure \--prefix=/usr/local/nginx \--with-http_ssl_module \--with-http_stub_status_module \--with-http_flv_module \--with-http_gzip_static_m 阅读全文

posted @ 2019-12-10 15:18 正义的伙伴! 阅读(95) 评论(0) 推荐(0) 编辑

nginx 静态分离,优化
摘要:location = / { root D:/project/application/meal/WebRoot; index index.html index.htm; #expires 7d; } location ~ .*\.(js|css|jpg|jpeg|png|html)?$ { root 阅读全文

posted @ 2019-12-02 07:57 正义的伙伴! 阅读(265) 评论(0) 推荐(0) 编辑

nginx 安装 tomcat pfx 格式证书
摘要:需要使用 openssl !!!!!!!!! 首先,nginx在编译安装时得安装ssl模块上传ssl证书到服务器/usr/local/nginx/ssl/xxx.pfx 生成证书crt可key openssl pkcs12 -in /usr/local/nginx/ssl/xxx.pfx -clce 阅读全文

posted @ 2019-10-17 14:47 正义的伙伴! 阅读(731) 评论(0) 推荐(0) 编辑

Nginx 基本 安装..
摘要:ubuntu 下 Nginx是高度自由化的Web服务器,它的功能是由许多模块来支持。如果使用了某个模块,这个模块使用了一些类似zlib或OpenSSL等的第三方库,那么就必须先安装这些软件。Ubuntu下不像在centOS中使用yum直接在线安装,可以使用以下方法。 (1)PCRE库 PCRE库支持 阅读全文

posted @ 2018-04-12 00:19 正义的伙伴! 阅读(143) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
//增加一段JS脚本,为目录生成使用
点击右上角即可分享
微信分享提示