nginx-configuration | Utilities and templates to create and manage | Runtime Evironment library
kandi X-RAY | nginx-configuration Summary
kandi X-RAY | nginx-configuration Summary
Collection of nginx configuration templates for various use cases, mainly intended to run PHP web applications.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of nginx-configuration
nginx-configuration Key Features
nginx-configuration Examples and Code Snippets
Community Discussions
Trending Discussions on nginx-configuration
QUESTION
I have an nginx service in my docker-compose. I'm trying to use this to obtain my first ssl cert from lets encrypt. It's not working and I cannot seem to exec into the container to check the conf settings.
I'm using envsubt and I suspect this is my issue, but since I cannot get into the container I cannot check. My set up:
...ANSWER
Answered 2021-Jun-09 at 21:01Try to restart the container and check the status of the container
docker restart
If the status is running then login to the container using
exec
commanddocker exec -it bash
QUESTION
I'd like to use envsubst with nginx docker alpine. Documentation:
Using environment variables in nginx configuration (new in 1.19)
Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But this image has a function, which will extract environment variables before nginx starts.
Here is an example using docker-compose.yml:
web: image: nginx volumes:
- ./templates:/etc/nginx/templates ports:
- "8080:80" environment:
- NGINX_HOST=foobar.com
- NGINX_PORT=80
By default, this function reads template files in /etc/nginx/templates/*.template and outputs the result of executing envsubst to /etc/nginx/conf.d.
I have a nginx container service of the form:
...ANSWER
Answered 2021-Jun-04 at 23:44Changing the command doesn't work because the /docker-entrypoint.sh
contains:
QUESTION
I have an nginx ingress in Kubernetes with both a whitelist (handled by a nginx.ingress.kubernetes.io/whitelist-source-range
annotation) and also a custom port mapping (which exposes an SFTP server port 22 via a --tcp-services-configmap
configmap). The whitelist works great for 80 and 443, but it does not work for 22. How do I whitelist my custom port?
Configuration looks roughly like this:
...ANSWER
Answered 2021-Apr-08 at 10:35Firstly take a look at this issue: ip-whitelist-support.
IPs are not whitelisted for TCP services, an alternative would be to create a separate firewall for the TCP services and whitelist the IPs at the firewall level.
For specific location {{ $path }} we have defined {{ if isLocationAllowed $location }}.
Check official Ingress documentation: ingress-kubernetes.
Ingress exposes HTTP and HTTPS routes from outside the cluster to services within the cluster. Traffic routing is controlled by rules defined on the Ingress resource.
An Ingress does not expose arbitrary ports or protocols. Exposing services other than HTTP and HTTPS to the internet typically uses a service of type Service.Type=NodePort or Service.Type=LoadBalancer.
You must have an Ingress controller to satisfy an Ingress. Only creating an Ingress resource has no effect.
In this case Ingress resource instrument ingress-controller how to deal with http/https requests. In this approach nginx-ingress controller as a software (introduce layer-7 functionality/loadbalancing).
If you are interested with nginx ingress tcp support:
Ingress does not support TCP or UDP services. For this reason this Ingress controller uses the flags --tcp-services-configmap and --udp-services-configmap
See: exposing-tcp-udp-services
If you want to check more granular configuration while working with your tcp service you should consider using L4 loadbalancing/firewall settings provided by your cloud provider.
QUESTION
I'm new to Kubernetes and I'm trying to deploy a React app to my cluster. Here's the basic info:
- Docker Desktop, single-node Kubernetes cluster
- React development frontend, exposing port 3000
- Node.js/Express backend, exposing port 8080
- NGINX Ingress Controller, serving my React frontend on "localhost:3000" and routing my Fetch API requests (fetch("localhost:3000/api/...", OPTIONS)) to the backend (which works)
I am having an issue when opening the React app. The Ingress Controller correctly routes to the app but the 3 bundles (bundle.js, main.chink.js, the third one which I don't remember) aren't loaded. I get the following error:
...ANSWER
Answered 2021-Mar-18 at 16:39The issue with your ingress.yaml is that the route for your ui should be /* and placed below the backend routing. Also, check your routing for APIs
QUESTION
I've a strange behaviour when trying to do some load testing.
Environment :
- NGINX Ingress controller version: 0.44.0
- Kubernetes version : 1.17.8
- openidc.lua version : 1.7.4
Here's the situation :
- The nginx ingress controller is deployed as daemonset, and due to the openidc module, I activated the sessionAffinity to ClientIP.
- I have a simple stateless rest service deployed with a basic ingress which is tested for load (no sessionAffinity on that one).
When launching load testing on the rest service without the sessionAffinity ClientIP, I reach far beyond 25 req/s (about 130 req/s before the service resources begin to crash, that's another thing). But with the sessionAffinity activated, I only reach 25 req/s.
After some research, I found some interesting things, desribed like here : https://medium.com/titansoft-engineering/rate-limiting-for-your-kubernetes-applications-with-nginx-ingress-2e32721f7f57
So the formula, as the load test should always be served by the same nginx pod, should be : successful requests = period * rate + burst
So I did try to add the annotation nginx.ingress.kubernetes.io/limit-rps: "100" on my ingress, but no luck, still the same 25 req/s.
I also tried different combinations of the following annotations : https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#rate-limiting, but no luck either.
Am I missing something ?
...ANSWER
Answered 2021-Feb-23 at 14:42In fact, it was more vicious than that.
It had nothing to do with the sessionAffinity, nor the rate limiting (in fact there's none by default, I didn't get it at first, the rate limit is only there if we want to limit for ddos purpose).
The prob was, I added in the configmap the options for modsecurity AND owasp rules.
And because of that, the request processing was so slow, it limited the number of request per seconds. When the sessionAffinity was not set, I didn't see the prob, as the req/s were fair, as distributed among all pods.
But with the sessionAffinity, so a load test on a single pod, the prob was clearly visible.
So I had to remove modsecurity and owasp, and it'll be the apps who will be responsible for that.
A little sad, as I wanted more central security on nginx so apps don't need to handle it, but not at that cost...
I'd be curious to understand what modsecurity is doing exatly to be so slow.
QUESTION
I recently upgraded my ingress controller to kubernetes-ingress v1.10.0. The ingresses seem to route traffic correctly but after checking the pods logs, I noticed a huge amount of notice were generated:
...ANSWER
Answered 2021-Feb-15 at 14:55I don't know the actual root cause but I deleted all the TLS secrets, certificates and ingresses that were being constantly being updated and recreated them. It solved this issue.
Different incidents happened prior to this issue and might have been related to it: 2 of my 3 ingress nodes failed, during the upgrade the wrong CRDs were applied before being quickly fixed.
That's all I can say at the moment, but deleting the resources related to the ingresses being constantly updated and recreating them do solve the issue.
QUESTION
I set up Lets encrypt using Certbot; everything works fine when I view my website via “website.com”, however when I use “www.website.com” I get a welcome to nginx landing page.
I’ve attempted to fix this by following a similar question posted on the community:[https://stackoverflow.com/questions/54244753/django-nginx-configuration-getting-welcome-to-nginx], following the step outline in the post I delete the default using rm /etc/nginx/sites-enabled/default but each time I try my website thereafter with the 'www' prefix it redirect to https://www.website.com with the error: This site can’t be reached ...unexpectedly closed the connection".
/etc/nginx/sites-available/default:
...ANSWER
Answered 2021-Jan-13 at 21:39Remove one of the server_name s.
Remember to nginx -s reload
. The rest of your code seams fine.
Did you use certbot --nginx
to get ssl for example.com
or www.example.com
?
Because I see both of them here.
If you still have the same issue, I suggest you remove the file, and also the shortcut, and start over. Once you make sure both example.com
or www.example.com
work correctly, then go after issuing the ssl.
And remember, you just need to get ssl for either example.com
or www.example.com
.
QUESTION
According to this doc (https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#server-alias), I'm able to add additional server_name to the nginx config file. However, it adds the extra server_name to all of my hosts, which cause conflicts for sure. Is there a way to add server-alias only for one of my hosts? Say I only want to add 10.10.0.100 to my test1 host. Ingress example:
...ANSWER
Answered 2021-Jan-04 at 12:47TL;DR
You can split your Ingress
resource on multiple objects (which will work together) to add Annotations
to only specific hosts
.
Annotations
can only be set on the whole kubernetes resource, as they are part of the resourcemetadata
. Theingress spec
doesn't include that functionality at a lower level.-- Stackoverflow.com: Questions: Apply nginx-ingress annotations at path level
Extending on the answer to give an example of how such setup could be created. Let's assume (example):
- All required domains pointing to the
Service
of typeLoadBalancer
ofnginx-ingress-controller
:hello.kubernetes.docker.internal
- used inhost
.spec
hello-two.kubernetes.docker.internal
- used inannotations
.metadata
- --
goodbye.kubernetes.docker.internal
- used inhost
.spec
goodbye-two.kubernetes.docker.internal
- used inannotations
.metadata
Skipping the Deployment
and Service
definitions, the Ingress
resources should look like below:
hello-ingress.yaml
QUESTION
I'm unable to get the controller working. Tried many times and still I get Error: ImagePullBackOff
.
Is there a alternative that I can try or any idea why its failing?
...ANSWER
Answered 2020-Dec-07 at 13:32It's failing because kubernetes cannot download the specified image. Check the events section
Warning Failed 3s kubelet Failed to pull image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:master": rpc error: code = Unknown desc = Error response from daemon: Get https://quay.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Maybe you dont have internet connectivity or this image does not exist. You can try running docker pull quay.io/kubernetes-ingress-controller/nginx-ingress-controller:master
from your computer
QUESTION
I have had weird problems in kubernetes. When I run install command, pods never started. Pvc was bound. It gave errors below order
...ANSWER
Answered 2020-Oct-12 at 14:39I have used old cluster.yaml file and added 'allowUninstallWithVolumes: false' under cleanupPolicy. That solves everything.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install nginx-configuration
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page