Questions tagged [nginx-config]
2020 questions
5
votes
2 answers
nginx - Passing request header variables to upstream URL as query parameter
I have an application running on localhost listening on port 8080
nginx is running as reverse proxy, listening on port 80
So, a request coming to nginx on port 80 is sent to this application listening on localhost:8080 and response from this…

Tahseen
- 1,027
- 1
- 12
- 32
5
votes
1 answer
How to set Content-Security-Policy for Web Workers to work in Edge / Safari?
I keep getting back error code: 18, SecurityError from Edge and Safari while trying to use a Web Worker. The workers are fine in Firefox / Chrome however. I'm using an inlined worker that I pass zero-dependency data processing functions to.
My CSP…

Sean Kelly
- 901
- 7
- 27
5
votes
0 answers
nginx - Rate limit for each individual url
I am having a issue where I am trying to set a rate limit for each individual URL in a single location block such as "location / { }"
limit_req_zone $request_uri zone=one:10m rate=6r/m;
location / {
proxy_pass http://app:8000;
…

wasabi_gardener
- 177
- 1
- 1
- 6
5
votes
1 answer
Is it possible to use variable with redirect code in Nginx configuration?
In my Nginx config I have redirect rules like this:
map $uri $target {
'/test123' 'https://www.somedomain.com/test456';
}
map $uri $target_code {
'/test123' 301;
}
server {
listen 80 default;
if ($target_code = 301) {
return…

quentino
- 1,101
- 1
- 10
- 25
5
votes
1 answer
Can I create a "private" location in Nginx?
Can I create a location which can be accessed by any other location in nginx config and cannot be accessed directly from outside?
I can use a deny directive, but it will also deny access to the locations defined in nginx config.
Here's my config -…

Mahesh H Viraktamath
- 818
- 3
- 14
- 34
4
votes
1 answer
Can't access nginx sites on wsl from windows browser
I installed wsl2 => then ubuntu => then nginx => php.fpm (version I need)
Then added mysite.local.conf to my nginx config but can't access the site on wsl from windows
nginx config code:
server {
listen 80 default_server;
server_name…

Arash Rabiee
- 1,019
- 2
- 16
- 31
4
votes
1 answer
How to get NGINX running in Docker to reload nginx.conf configuration
I am trying to get a NGINX based reverse proxy to work in Windows/WSL2 environment. I am very new to Docker and NGINX world. I am able to get the following command to work
docker run --name nginx-test -p 8080:80 -v…

Shreedhar Kotekar
- 1,034
- 10
- 20
4
votes
1 answer
Check configurations applied for nginx ingress controller on a kubernetes cluster
I have setup nginx ingress controller configurations under the data property as shown in the below yaml file.
I would like to know is this the correct way to set nginx configurations instead of providing a nginx.conf file.
Secondly I would like to…

jeril
- 1,109
- 2
- 17
- 35
4
votes
0 answers
nginx proxy pass: trailing slash, vars don't work
I can't wrap my head around how this is not the same:
does not work
set $upstream_app myapp;
set $upstream_port 1234;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port/;
does work
proxy_pass…

Sutider
- 41
- 2
4
votes
1 answer
Nginx to serve contents of S3 files in browser
I want to open files from S3 served by Nginx in a browser. Was unable to get it working with following config
Files in S3 buckets are text files with extension .manefiest
location /manefiest/ {
proxy_pass…

roy
- 6,344
- 24
- 92
- 174
4
votes
0 answers
nginx if / condition on an environment variable
Have a need for environment variable condition in nginx server config. The location directive by itself works but getting invalid condition for any test on the environment variable.
# Proxy files to live site
if ($LIVE_DOMAIN != '') {
location…

Dustin Butler
- 818
- 7
- 22
4
votes
1 answer
Removing 'server' header from response header of Nginx version 1.18 in Ubuntu 20.04
I could not able to remove 'Server' header from response header of Nginx version 1.18 in Ubuntu 20.04 OS.
I have done the following steps:
sudo apt-get update
Installed nginx-extras by using command 'sudo apt-get install nginx-extras'
Added the…

Tijo
- 93
- 1
- 5
4
votes
1 answer
Nginx + GraphQL Connection Refused
My Client (next.js) app running at port 3000
My Server (graphql) app running at port 4000
My website is https://example.com, nginx will pass proxy port 3000.
If the user access the site, the page is loaded successfully.
But behind the scene, In…

ton1
- 7,238
- 18
- 71
- 126
4
votes
2 answers
How to fix "The connection was reset" on nginx and docker
I use nginx inside a docker container and I'm unable to connect to it properly.
The error inside the browser is:
The connection was reset
if I try to curl inside the container I get:
/usr/share/nginx/html # curl localhost
curl: (7) Failed to…

Olivier D'Ancona
- 779
- 2
- 14
- 30
4
votes
0 answers
Nginx : Conditionally listen to SSL port if valid certificates are present in directory
I need to support both http and Https for my service which is using Nginx. Below code in nginx.conf file does this job:
server
{
listen 80 default_server;
listen 443 ssl;
keepalive_timeout 70;
ssl_protocols …

TheVee
- 51
- 2