nginx

Nginx + phpFPM: PATH_INFO always empty

一笑奈何 提交于 2020-12-30 06:21:29
问题 I configured nginx stable (1.4.4) + PHP (using FastCGI, php-fpm) on Debian. That works fine: location ~* ^/~(.+?)(/.*\.php)$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; alias /home/$1/public_html$2; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_index index.php; autoindex on; } I use the PATH_INFO variable, therefore I added the following line to fastcgi_params: fastcgi_param PATH_INFO $fastcgi_path_info; And in /etc

kubernetes ingress-nginx原理

僤鯓⒐⒋嵵緔 提交于 2020-12-29 18:38:47
Ingress 英文翻译 进入;进入权;进食 ,更准确的讲就是 入口 ,即外部流量进入 k8s 集群必经之口。这道大门到底有什么作用?我们如何使用 Ingress ? k8s 又是如何进行服务发现的呢?先看一张图: 原理 虽然 k8s 集群内部署的 pod 、 server 都有自己的 IP ,但是却无法提供外网访问,以前我们可以通过监听 NodePort 的方式暴露服务,但是这种方式并不灵活,生产环境也不建议使用。 Ingresss 是 k8s 集群中的一个 API 资源对象,扮演边缘路由器(edge router)的角色,也可以理解为 集群防火墙 、 集群网关 ,我们可以 自定义路由规则 来转发、管理、暴露服务(一组pod),非常灵活,生产环境建议使用这种方式。另外 LoadBlancer 也可以暴露服务,不过这种方式需要向云平台申请负债均衡器;虽然目前很多云平台都支持,但是这种方式深度耦合了云平台,所以你懂的。 首先我们来思考用传统的 web 服务器,比如 Nginx ,如何处理这种场景? Nginx 充当一个反向代理服务器拦截外部请求,读取路由规则配置,转发相应的请求到后端服务。 kubernetes 处理这种场景时,涉及到三个组件 : 反向代理 web 服务器 负责拦截外部请求,比如 Nginx 、 Apache 、 traefik 等等。我一般以 Deployment

Nginx Redirect HTTP to HTTPS and WWW to Non-WWW

為{幸葍}努か 提交于 2020-12-29 14:13:21
问题 I'm having issues with this config: #=========================# # domain settings # #=========================# # Catch http://domain, and http://www.domain server { listen 80; server_name www.domain domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://www.domain server { listen 443; server_name www.domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://domain server { listen 443; server_name domain; root /usr

Nginx Redirect HTTP to HTTPS and WWW to Non-WWW

核能气质少年 提交于 2020-12-29 14:07:26
问题 I'm having issues with this config: #=========================# # domain settings # #=========================# # Catch http://domain, and http://www.domain server { listen 80; server_name www.domain domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://www.domain server { listen 443; server_name www.domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://domain server { listen 443; server_name domain; root /usr

Nginx Redirect HTTP to HTTPS and WWW to Non-WWW

Deadly 提交于 2020-12-29 14:06:47
问题 I'm having issues with this config: #=========================# # domain settings # #=========================# # Catch http://domain, and http://www.domain server { listen 80; server_name www.domain domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://www.domain server { listen 443; server_name www.domain; # Redirect to https://domain return 301 https://domain$request_uri; } # Catch https://domain server { listen 443; server_name domain; root /usr

Nacos 集群部署

假装没事ソ 提交于 2020-12-29 08:01:47
关于nacos 集群部署,网上的示例往往不全或不可用,而官方的教程太简单了。官方也提供了一个 docker + nacos 的伪集群的 部署示例。但毕竟是 伪, 不能实际生产使用。 全网就几乎就没有一个 完整的教程???!!! 怎么办呢? 自己动手吧。 准备数据库 数据库用了 mysql, 其实nacos 也是支持mysql 主从集群的,不过简单起见, 这里就只用了一个 mysql 节点。 mysql 是需要自己事先安装 配置的(需要执行 nacos 提供的 conf/nacos-mysql.sql 脚本) 这个其实很简单。schema 名字不重要,重要的是 执行 nacos 的sql 脚本就好了。 准备nacos 一般集群需要至少3个节点。我们先准备3台机器: 192.168.11.200、192.168.11.196、192.168.11.126 nacos 的默认服务端口是 8848 ,但是由于 我们的机器上还有其他nacos 服务正在作用,所以, 我们这里把端口改为 8748, 如下: 192.168.11.200:8748 192.168.11.196:8748 192.168.11.126:8748 我们需要nacos-server 的安装包, 1.0.0.zip 版本并没有 集群的展示功能, 我们这里使用 nacos-server-1.1.0.zip, 这个也是最新的

Can nginx do TCP load balance with SSL termination

给你一囗甜甜゛ 提交于 2020-12-29 04:43:09
问题 Due to some reason, I need to set up nginx tcp load balance, but with ssl termination. I am not sure whether Nginx can do this. Since tcp is layer 4, ssl is layer 5, SSL pass-thru definitely work. But with SSL-termination? Thanks for suggestions. 回答1: Nginx can act as L3/4 balancer with stream module: https://www.nginx.com/resources/admin-guide/tcp-load-balancing/ Because SSL still tcp - Nginx can proxy SSL traffic without termination. Also stream module can terminate SSL traffic, but it's

Can nginx do TCP load balance with SSL termination

Deadly 提交于 2020-12-29 04:42:23
问题 Due to some reason, I need to set up nginx tcp load balance, but with ssl termination. I am not sure whether Nginx can do this. Since tcp is layer 4, ssl is layer 5, SSL pass-thru definitely work. But with SSL-termination? Thanks for suggestions. 回答1: Nginx can act as L3/4 balancer with stream module: https://www.nginx.com/resources/admin-guide/tcp-load-balancing/ Because SSL still tcp - Nginx can proxy SSL traffic without termination. Also stream module can terminate SSL traffic, but it's

Can nginx do TCP load balance with SSL termination

冷暖自知 提交于 2020-12-29 04:42:05
问题 Due to some reason, I need to set up nginx tcp load balance, but with ssl termination. I am not sure whether Nginx can do this. Since tcp is layer 4, ssl is layer 5, SSL pass-thru definitely work. But with SSL-termination? Thanks for suggestions. 回答1: Nginx can act as L3/4 balancer with stream module: https://www.nginx.com/resources/admin-guide/tcp-load-balancing/ Because SSL still tcp - Nginx can proxy SSL traffic without termination. Also stream module can terminate SSL traffic, but it's

kubernetes yaml详解

南笙酒味 提交于 2020-12-29 03:26:21
--- apiVersion: v1 kind: ReplicationController #类型是一个RC metadata: name: nginx-controller spec: replicas: 2 #我想要2个RC selector: name: mynginx template: metadata: labels: name: mynginx spec: containers: - name: mynginx image: reg.zll.com/web/nginx:1.12.2 #前端需要部署在nginx上,这里是对应的nginx的镜像。 volumeMounts: - name: httpd-storage mountPath: /etc/nginx/nginx.conf #镜像中nginx的配置文件地址,用下面的path:/home/nginx.conf去代替此路径。 - name: httpd-storag mountPath: /usr/local/dist ports: - containerPort: 80 volumes: - name: httpd-storage hostPath: path: /home/nginx.conf #自定义的nginx的配置文件,挂载到服务器上的这一路径下,去代替镜像中nginx的配置 - name: httpd