nginx

记一次全站升级https引发的一系列问题

那年仲夏 提交于 2021-02-08 05:30:39
中秋假期,闲来无事。花了一下午折腾了下https,说实话这年头还有网站不上https显然是折腾精神不够啊~ 1、SSL证书评估 看了市面上各种类型的证书,有收费的也有免费的,但是最终还是选择了腾讯云提供的TrustAsia一年免费期的证书,没有次数限制,可以过期后再次申请。最主要的原因还是我懒,哈哈~~ 2、SSL证书安装 从腾讯云将申请的证书下载到本地,解压获得3个文件夹,分别是Apache、IIS、Nginx 服务器的证书文件,可以根据自己的实际情况,安装在三种服务器上。 我这里使用Nginx做前端转发。更多的介绍可以查看文档:https://cloud.tencent.com/document/product/400/4143 2.1 获取证书 Nginx文件夹内获得SSL证书文件 1_www.domain.com_bundle.crt 和私钥文件 2_www.domain.com.key, 1_www.domain.com_bundle.crt 文件包括两段证书代码 “-----BEGIN CERTIFICATE-----”和“-----END CERTIFICATE-----”, 2_www.domain.com.key 文件包括一段私钥代码“-----BEGIN RSA PRIVATE KEY-----”和“-----END RSA PRIVATE KEY-----”。

Make links in response relative to new path

喜夏-厌秋 提交于 2021-02-08 04:09:29
问题 How do I redirect all my hrefs within my response to hit my new path. For e.g., my ingress file is apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-odin annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - http: paths: - path: /odin/?(.*) backend: serviceName: flask-app-tutorial servicePort: 8080 When I visit the page at https://mysite/odin. It works and returns back the response: The HTML response is: <html> .. <body> <div> <a href="/v0/index">Home<

Make links in response relative to new path

佐手、 提交于 2021-02-08 04:07:16
问题 How do I redirect all my hrefs within my response to hit my new path. For e.g., my ingress file is apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-odin annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - http: paths: - path: /odin/?(.*) backend: serviceName: flask-app-tutorial servicePort: 8080 When I visit the page at https://mysite/odin. It works and returns back the response: The HTML response is: <html> .. <body> <div> <a href="/v0/index">Home<

Make links in response relative to new path

时光毁灭记忆、已成空白 提交于 2021-02-08 04:05:21
问题 How do I redirect all my hrefs within my response to hit my new path. For e.g., my ingress file is apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-odin annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - http: paths: - path: /odin/?(.*) backend: serviceName: flask-app-tutorial servicePort: 8080 When I visit the page at https://mysite/odin. It works and returns back the response: The HTML response is: <html> .. <body> <div> <a href="/v0/index">Home<

Make links in response relative to new path

青春壹個敷衍的年華 提交于 2021-02-08 04:05:08
问题 How do I redirect all my hrefs within my response to hit my new path. For e.g., my ingress file is apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress-odin annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - http: paths: - path: /odin/?(.*) backend: serviceName: flask-app-tutorial servicePort: 8080 When I visit the page at https://mysite/odin. It works and returns back the response: The HTML response is: <html> .. <body> <div> <a href="/v0/index">Home<

Docker nginx reverse proxy returns 502 bad gateway “connection refused while connecting to upstream”

∥☆過路亽.° 提交于 2021-02-08 04:01:18
问题 I'm trying to set up nginx reverse proxy in a container to another container where my app is running. Here is my nginx.conf: daemon off; user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x

Webpack devserver with Nginx and Docker: polling info on the wrong address

被刻印的时光 ゝ 提交于 2021-02-08 03:40:44
问题 I have 2 containers in Docker: Node.js + Webpack devserver which listen on port 3000 Nginx which listen on port 80 (mapped on host port 8080 through docker-compose file) Nginx correctly proxy requests to the node container and I can access the node app at http://localhost:8080, but for some reasons there are other polling requests of the type http://localhost:3000/sockjs-node/info?t=1570780621084 that fail (net::ERR_CONNECTION_REFUSED) because on the host only Nginx on port 8080 is visible. I

ActionCable - Error during WebSocket handshake: Unexpected response code: 404

让人想犯罪 __ 提交于 2021-02-08 03:31:31
问题 Have deployed my Rails 5.2 app via Capistrano, and am having problems with ActionCable. I am using Nginx, Puma and Lets Encrypt. I have tried many combinations of configuration, but each time am receiving the same error. I am not sure how to debug this issue, and suggestions as well and any tips on re-arranging my ngnx.conf would be well-appreciated. Have changed the real website to website.com nginx.conf upstream puma { server unix:///home/deploy/apps/website/shared/tmp/sockets/website-puma

convert nginx conf to apache conf for proxypass

北城以北 提交于 2021-02-08 02:33:16
问题 I need to convert this nginx conf to apache conf. As i have tried to convert, But failed to get it. upstream apiUpstream { # 1. Set your port here server 127.0.0.1:8080; keepalive 64; } server { listen 80; listen 443 ssl; # 2. Set your API domain name here server_name yourdomain.com; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # RequestHeader set X-Forwarded-Port "443" proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_http_version 1

convert nginx conf to apache conf for proxypass

 ̄綄美尐妖づ 提交于 2021-02-08 02:32:29
问题 I need to convert this nginx conf to apache conf. As i have tried to convert, But failed to get it. upstream apiUpstream { # 1. Set your port here server 127.0.0.1:8080; keepalive 64; } server { listen 80; listen 443 ssl; # 2. Set your API domain name here server_name yourdomain.com; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # RequestHeader set X-Forwarded-Port "443" proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_http_version 1