nginx

Nginx - Infinite reload when adding variable in proxy_pass

空扰寡人 提交于 2021-02-15 03:08:44
问题 I am working with Nginx on Docker and I want to assign each user to a different port. First, without adding anything, my code works fine: location /viewer/ { proxy_pass http://xx.xxx.xxx.xxx:18080/Road/; } Going to "/viewer/" in URL will proxy to the port 18080, just as expected. But if I add any variable to the proxy_pass like: set $test 1; proxy_pass http://xx.xxx.xxx.xxx:18080/Road/?$test; then, first of all, the static files do not load anymore and I have to add lines like these: location

Nginx - Infinite reload when adding variable in proxy_pass

让人想犯罪 __ 提交于 2021-02-15 03:01:24
问题 I am working with Nginx on Docker and I want to assign each user to a different port. First, without adding anything, my code works fine: location /viewer/ { proxy_pass http://xx.xxx.xxx.xxx:18080/Road/; } Going to "/viewer/" in URL will proxy to the port 18080, just as expected. But if I add any variable to the proxy_pass like: set $test 1; proxy_pass http://xx.xxx.xxx.xxx:18080/Road/?$test; then, first of all, the static files do not load anymore and I have to add lines like these: location

Nginx - Infinite reload when adding variable in proxy_pass

筅森魡賤 提交于 2021-02-15 03:01:07
问题 I am working with Nginx on Docker and I want to assign each user to a different port. First, without adding anything, my code works fine: location /viewer/ { proxy_pass http://xx.xxx.xxx.xxx:18080/Road/; } Going to "/viewer/" in URL will proxy to the port 18080, just as expected. But if I add any variable to the proxy_pass like: set $test 1; proxy_pass http://xx.xxx.xxx.xxx:18080/Road/?$test; then, first of all, the static files do not load anymore and I have to add lines like these: location

后端架构师图鉴

放肆的年华 提交于 2021-02-15 02:57:15
后端架构师图鉴 作者:星晴(当地小有名气,小到只有自己知道的杰伦粉) 忽略:我准备从博客园( https://www.cnblogs.com/pingping-joe/ )转移到公众号了!!! 从2017年开始写博客到现在,经历了几家公司,碰到不少有趣的人,人也成长不少,褪去幼稚的面孔,只剩下越发后移的发际线;一路坎坷,唯一还在坚持的就只剩下写博客了,虽然不知道为什么坚持,但是感觉还不错。 今天第一天发公众号推文,作为搞java的,还是给大家准备了架构师的学习路线。当然如果大家都知道,可以忽略。 架构师学习路线大致分为五个部分: 互联网运维 Git,Maven,Gradle,jenkins,linux 框架源码分析 Spring , Mybatis 并发编程 并发包 性能调优 JVM调优,Mysql调优,Nginx调优,Tomcat调优 分布式框架 分布式服务治理:Dubbo, Zookeeper, SpringCloud-Alibaba,SpringCloud-NetFliex 分布式消息:RocketMq, RabbitMq, Kafka 分布式数据缓存:Redis 分布式数据存储:Sharding-sphere 分布式通信:Netty 分布式搜索引擎:ELK 如果想要完整的学习路线,请关注公众号,并且回复【1】,谢谢支持 本文分享自微信公众号 - 喜欢奶茶的星晴(code

微服务之SpringCloud基础

故事扮演 提交于 2021-02-14 21:37:10
SpringCloud微服务基础 微服务架构--SpringCloud 网站架构模式 单点应用/分布式系统面向于服务架构(SOA) /微服务架构 web项目 三层架构 1.控制层 2.业务逻辑层 3.数据访问层 传统项目:代码全部在一个项目中,使用包名来区分 com.controller--控制 com.service--业务逻辑层 com.dao--数据访问层 面向服务架构 公司 (如果互联网公司,如果使用传统架构技术开发代码冲突,拆分项目) 1.分布式开发:将一个大的公司,拆分成n个子项目。 会员系统/支付系统/消息系统/微信系统 2.集群:将一个项目,相同功能部署在多台不同服务器。 作用:解决高并发。 分布式架构就是将一个项目拆分成n多个子项目,每个子项目使用rpc远程调用技术。 你用过哪些rpc远程调用框架 SpringCloud/HttpClient/hessioan/dubbo 面向于微服务架构(SOA),通信协议SOAP SOAP http协议+xml序列号与反序列化 银行使用webservice 反向代理服务器 nginx a.tomcate01 b.tomcate02 c.客户端 SOA服务项目,提供外部访问接口 提供外部访问接口 (业务逻辑层和数据访问层) web工程-->rpc远程调用 (控制层) 面向于服务架构优点:代码服务/解耦,适合于大公司人多。 缺点

Nginx开启gzip压缩功能

限于喜欢 提交于 2021-02-14 18:02:58
Nginx开启gzip压缩功能提高加载速度 1.打开/etc/nginx/nginx.conf配置文件 2.启用gzip 1 gzip on; 2 gzip_min_length 1k; 3 gzip_buffers 4 16k; 4 #gzip_http_version 1.0 ; 5 gzip_comp_level 2 ; 6 gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/ png; 7 gzip_vary off; 保存后执行 nginx -s reload 3.用curl测试是否成功 1 [root@iz2zeacp86oa3g0vhvowk4z ~]# curl -I -H " Accept-Encoding: gzip, deflate " " https://www.lpjnote.com " 2 HTTP/ 1.1 200 OK 3 Server: nginx/ 1.16 . 0 4 Date: Sun, 28 Apr 2019 09 : 09 : 33 GMT 5 Content-Type: text/html; charset=UTF

nginx 配置文件详解

荒凉一梦 提交于 2021-02-14 16:51:20
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数。 worker_processes 8; #全局错误日志定义类型,[ debug | info | notice | warn | error | crit ] error_log /usr/local/nginx/logs/error.log info; #进程pid文件 pid /usr/local/nginx/logs/nginx.pid; #指定进程可以打开的最大描述符:数目 #工作模式与连接数上限 #这个指令是指当一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(ulimit -n)与nginx进程数相除,但是nginx分配请求并不是那么均匀,所以最好与ulimit -n 的值保持一致。 #现在在linux 2.6内核下开启文件打开数为65535,worker_rlimit_nofile就相应应该填写65535。 #这是因为nginx调度时分配请求到进程并不是那么的均衡,所以假如填写10240,总并发量达到3-4万时就有进程可能超过10240了,这时会返回502错误。 worker_rlimit_nofile 65535; events { #参考事件模型,use [

dockerfile构建镜像

强颜欢笑 提交于 2021-02-14 16:12:40
Dockerfile是由一系列命令和参数构成的脚本,这些命令应用于基础镜像并最终创建一个新的镜像。它们简化了从头到尾的流程并极大的简化了部署工作。Dockerfile从FROM命令开始,紧接着跟随者各种方法,命令和参数。其产出为一个新的可以用于创建容器的镜像。 一、Dockerfile 语法 使用以下的语法可以实现各种各样的镜像 FROM:指定父镜像,可以通过添加多个FROM,在同一个Dockerfile中创建多个镜像 MAINTAINER:维护者信息,可选 RUN:用来修改镜像的命令,可以用来安装程序,当一条RUN完成后,会在当前的镜像上创建一个新的镜像层,接下来的指令会在新的镜像层上执行。有2种形式。 RUN [“apt-get”, “update”],调用exec RUN apt-get update,调用的/bin/sh EXPOSE:用来指明容器内进程对外开放的端口。在docker run的时候可以加-p(可以将EXPOSE中没列出的端口设置为对外开放)和-P(EXPOSE里所指定的端口映射到主机上另外的随机端口???)来设置端口。 ADD:向新容器中添加文件,文件可以是 主机文件:必须是相对Dockerfile所在目录的相对路径(如果是压缩文件,docker会解压缩) 网络文件:URL文件,在创建容器时会下载下来添加到镜像中。(如果是压缩文件,docker不会解压缩)

从小白到全站 Docker 化

北慕城南 提交于 2021-02-14 14:06:35
笔者花生 PeA,百度前端汪、ACGer。个人博客:pea3nut.blog;个人资料:pea3nut.info。 本篇文章详细而又简短的介绍了:一名完全不了解 Docker 小白,将全站 Docker 化的过程。内容主要包含: Docker 基本概念 真实站点迁移过程: 静态站点 Nodejs 站点 WordPress(PHP) 一些必备技巧:开机启动、常用 Shell 文章会讲解使用 Docker 过程中用到的全部技术栈(GitHub CI、Nginx 反向代理、docker-compose),绝不会出现“详见:http://xxx”甩链接的情况。 无需再查阅其他文档,看着一篇就够了! 当前有哪些问题 手动部署成本太高 笔者维护了诸多网站,其中包含: 我的简历:pea3nut.info,使用 Vuejs 构建的SPA单页应用,纯静态 我的博客:pea3nut.blog,使用著名的 WordPress 搭建(PHP+Apache+MySQL) 一个开源项目——Pxer:pxer.pea3nut.org,官网使用 Nodejs + Express SSR 搭建 而每次我想修改某个网站内容是十分麻烦的。拿大家熟悉的纯静态站点来说,修改过程如下: 下载:从 GitHub 下载代码,然后本地部署 开发:本地修改代码,测试 编译:编译前端项目,产出静态资源 上传:打开FTP软件

Nginx + php-fpm: 504 timeout error - upstream timed out (110: Connection timed out)

好久不见. 提交于 2021-02-14 11:03:55
问题 Is the first time we set up Nginx and PHP-FPM. A week back we were using Apache to serve a webpage, but we have decided to try out the Nginx combination and we are facing several problems. We have a Virtual Machine running Ubuntu 14.04 LTS Trusty. Among other utilities, the machine is running Nginx with PHP-FPM and MySQL, and here is when the problem comes: From the same network, all coworkers (around 10) can access the web without problem, while there is one coworker that cannot (Error 504).