Questions tagged [nginx-location]

Questions related to nginx location directive should use this tag.

1424 questions
3
votes
1 answer

Nginx 403 Forbidden for location and localhost

My target is to access to a specific location (i.e. phpmyadmin) using an SSH tunnel http://localhost/phpmyadmin I have just installed Ubuntu 20.04 with Nginx. The following configuration was working fine with Ubuntu 18.04. I edited…
Steve
  • 97
  • 1
  • 1
  • 9
3
votes
1 answer

Nginx Rate limit GET or POST requests only at a location

I have a server in nginx configured and have the following code to create my rate limit zone: limit_req_zone $key zone=six_zone:10m rate=60r/m; In my location, I use a module to serve the requests. This location supports GET, POST and DELETE…
whiplash
  • 695
  • 5
  • 20
3
votes
1 answer

NGINX dynamic location to create dynamic og:image

I developed a site that shows some products from a store. The site URL looks like that: http://testsite.com The site has the functionality of sharing the product (it's already working) generating a link that can be shared at facebook or WhatsApp or…
Derzu
  • 7,011
  • 3
  • 57
  • 60
3
votes
2 answers

Docker- nginx -Reverse proxy : host not found in upstream when building with docker-compose

I am using NGINX container to redirect certain requests to another container.While running docker-compose up -d , i am getting bellow error. " 2019/09/26 18:05:00 [emerg] 1#1: host not found in upstream "abcplus-visualize:61613" in…
3
votes
1 answer

Send all requests to index.html except certain extensions

I'm using nginx to serve my react app and it serves me well in redirecting everything except static files to index.html with the following: location / { try_files $uri /index.html =404; } I was content with this for some time but noticed that…
vinczemarton
  • 7,756
  • 6
  • 54
  • 86
3
votes
0 answers

Separate limit_req_status per zone - nginx throttling

I'm testing nginx rate limiting example. The directive limit_req_status can return a custom error message for requests that exceed the zone's rate limit. I've defined 2 zones (limit1 & limit2). Is it possible to return a different error message for…
user
  • 17,781
  • 20
  • 98
  • 124
3
votes
0 answers

Nginx add specific prefix if not exist in URL

I have lots of URLs like https://www.example.com/some-random-page1 https://www.example.com/test/some-random-page2 https://www.example.com/test/some-random-page3 https://www.example.com/some-random-page4 https://www.example.com/some-random-page5 I…
3
votes
0 answers

Nginx location and try_files in subdirectory

I'm trying to configure nginx vhost for application and stucked. App is in directory /site/verb At this moment app have this kind of links and it is working: http://example.com/verb/lt.php?some_args=some_args&some_args?some_args What I need? I need…
qtop
  • 31
  • 1
3
votes
2 answers

Rewrite in Subpath 404 urls with Nginx

Currently I have a main redirect to the home of my webserver. However I would like to treat the subpaths with redirect after a 404 was not for the home and yes for the subpath, that with multiple subpaths. That not to repeat the rules, I must deal…
3
votes
1 answer

NGinx and multiple docker containers but one subdomain

My Goal I want to use a single NGinx docker container as a proxy. I want it to respond to traffic on my domain: "sub.domain.com" and listen on port 80 and 443. When traffic comes in on /admin I want it to direct all traffic to one docker container…
Captainlonate
  • 4,878
  • 4
  • 25
  • 35
3
votes
1 answer

Can't rename specific .php file with .html names on nginx

I had an apache server where I was running my php application. It had these htaccess rules: php_flag log_errors Off RewriteEngine on RewriteRule thankyou.html /thankyou.php RewriteRule ^([^/]*)\.html$ /user.php?username=$1 [L] RewriteCond %{HTTPS}…
Giuseppe87
  • 406
  • 4
  • 14
3
votes
1 answer

How do I correctly use try_files when looking in two different directories for files to serve?

I'm quite new to Nginx so I might be misunderstanding of what try_files can do. For my local development set up I have multiple installations that will each be accesible via their own subdomain. These installations are being migrated into a new…
Rimble
  • 873
  • 8
  • 22
3
votes
2 answers

Nginx: limit_conn vs upstream max_conns (in location context)

Environment: Nginx 1.14.0 (see dockerfile for more details). To limit the number of concurrent connections for a specific location in a server, one can use two methods - limit_conn (third example for all ips) and upstream max_conns. Is there a…
g.ferr
  • 33
  • 1
  • 4
3
votes
1 answer

nginx redirect to wrong website

I have config two node apps running behind nginx. nginx is used as revers proxy, one domain redirects to wrong app on it default url, app1 port 3000 domain http://www.site1.com and https://www.site1.com app2 port 3001 domain…
Awais
  • 93
  • 1
  • 10
3
votes
4 answers

Nginx multiple locations for multiple Node JS Express Apps

I have the following configuration: location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://localhost:3000; # this is where our…
Janosch Hübner
  • 1,584
  • 25
  • 44