nginx

ingress nginx redirect from www to https

房东的猫 提交于 2021-01-29 13:58:14
问题 I'm trying to redirect http://www... and https://www... to https://... using ingress-nginx. How can I do that? I've tried adding the following custom configuration using the annotation nginx.ingress.kubernetes.io/server-snippet and nginx.ingress.kubernetes.io/configuration-snippet : # 1 if($host = "www.example.com") { return 308 https://example.com$request_uri; } # 2 server { server_name www.example.com; return 308 https://example.com$request_uri; } # 3 server_name www.example.com; return 308

Set proxy_pass in nginx based on request_method

二次信任 提交于 2021-01-29 13:02:14
问题 I have two application and a nginx server on top of that. I want to proxy all GET requests coming on nginx to one app running on http://127.0.0.1:9101/ and proxy all other request methods to http://10.41.115.241:8000/ I have tried couple of options but none worked I have tried using limit_exempt location /api/v1/executions { error_page 502 = @apiError; rewrite ^/api/(.*) /$1 break; proxy_pass http://127.0.0.1:9101/; limit_except PUT POST DELETE { proxy_pass http://10.41.115.241:8000/; } proxy

Set proxy_pass in nginx based on request_method

前提是你 提交于 2021-01-29 12:21:16
问题 I have two application and a nginx server on top of that. I want to proxy all GET requests coming on nginx to one app running on http://127.0.0.1:9101/ and proxy all other request methods to http://10.41.115.241:8000/ I have tried couple of options but none worked I have tried using limit_exempt location /api/v1/executions { error_page 502 = @apiError; rewrite ^/api/(.*) /$1 break; proxy_pass http://127.0.0.1:9101/; limit_except PUT POST DELETE { proxy_pass http://10.41.115.241:8000/; } proxy

Which comes first - creating the nginx site `.conf` file or running `certbot-auto certonly`?

孤人 提交于 2021-01-29 12:14:49
问题 I'm trying to automate the setup of certbot + nginx on a server using Ansible. The first time it runs, there are no letsencrypt certificates (yet). However I create the nginx conf as follows, referencing SSL/cert directories that will be created by certbot server { listen 443 ssl; server_name example.co; # ... # SSL ssl_certificate /etc/letsencrypt/live/example.co/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.co/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf;

how to redirect my domain to localhost: 3000 using ngnix

安稳与你 提交于 2021-01-29 12:11:00
问题 I'm new to all of this. I'm going to put you in context. I bought a domain miweb.pe and an instance in aws. Currently my domain redirects to my aws instance because I have registered the dns servers of my amazon instance in myweb.pe . I bought an ssl certificate and am trying to install it on my amazon instance, where I also installed nginx . I am unable to make any request to myweb.pe redirect to the aws instance that currently has a nodejs service active under port 3000. this is my current

Wrong cache key for SSI-subrequests with FastCGI

谁说胖子不能爱 提交于 2021-01-29 11:38:05
问题 When I use SSI, NGinx uses the wrong cache key for the subrequest fastcgi_cache_key "$request_method $scheme://$host$uri"; The problem is, that it ends up in an infinite recursion, because on the main request NGinx stores the page including the SSI-element in its cache and then when it triggers the subrequest, uses this page (including the SSI-element) as result of the subrequest (and so on and so on). I thought $uri is exactly designed to avoid this (unlike $request_uri ), but obviously it

Angular and dotnetcore connection in Kubernetes throw 404

孤街浪徒 提交于 2021-01-29 11:29:54
问题 I struggle several days with that, and I can't find any solution. These are my files: Deployments: database: apiVersion: apps/v1 kind: Deployment metadata: name: dbdeployment labels: app: dbdemployment spec: selector: matchLabels: app: dbdeployment replicas: 1 template: metadata: name: dbdeployment labels: app: dbdeployment spec: containers: - name: dbcontainer image: docker.io/library/sc_db:cluster imagePullPolicy: Never ports: - containerPort: 5432 backend: apiVersion: apps/v1 kind:

Nginx reverse proxy - Internal servers separated by trailing slash

烂漫一生 提交于 2021-01-29 11:24:17
问题 I'm a newbie at Nginx, and have been searching a lot for the right answer to my question, but couldn't find it; not because it is not there, but my newbie condition limits me to adapt a generic solution to my issue. The situation is this: I have a Mantis Bug Tracker in my private LAN (http://10.111.111.12). On the other hand, i have an OwnCloud website also on my LAN (IP 10.111.111.5), with URL http://10.111.111.5/owncloud/. What i want to do is to deploy a Nginx Reverse Proxy that handles

PATH_INFO in $_SERVER always empty - NGINX + FPM 7.3 + Ubuntu 18.04

自古美人都是妖i 提交于 2021-01-29 11:23:23
问题 I am deploying my web application at DigitalOcean. My environment is: Ubuntu 18.04, PHP + FPM 7.3, NGINX. My routing system is based on the $_SERVER PATH_INFO, but it only returns empty, so I can't access my routes. I already researched the solution and none of StackOverflow worked for me. My default file in /etc/nginx/sites-enabled is: server { listen 80; listen [::]:80; root /usr/share/nginx/my-site/public; index index.php index.html index.htm; server_name localhost; location / { try_files

Nginx geoip redirect , but exclude URL

霸气de小男生 提交于 2021-01-29 11:10:04
问题 Currently, I have the following setup for GeoIP redirect in Nginx: set $fromAU 0; set $isAUuri 0; set $isUSuri 0; if ( $geoip_country_code = "AU" ) { set $fromAU 1; } if ( $request_uri ~* "^/australia" ) { set $isAUuri 1; } if ( $request_uri ~* "^/usa-can" ) { set $isUSuri 1; } if ( $request_uri ~* ^/(wp-admin|wp-login\.php) ) { set $isUSuri 1; } set $redirectableAU "${fromAU}${isAUuri}"; if ( $redirectableAU = "10" ) { rewrite "^(/australia)?(.*)" $scheme://$host/australia permanent; } if (