Questions tagged [nginx-config]

2020 questions
12
votes
3 answers

adding AWS public certificate with NGINX

I am using EC2 and working with NGINX (by PuTTY); I chose AWS Public Certificate therefore I understood that to use HTTPS I need to configure the NGINX too. I found some tutorial about it, but everywhere they add ssl_certificate and…
Yoni
  • 155
  • 1
  • 1
  • 8
12
votes
4 answers

How to set Secure attribute to Set-cookie in Nginx through nginx.conf file

I am new to Nginx server. recently started working nginx project. I have task to set security headers through nginx.conf file. I set some header correctly but not able to set for Set-cookie. My requirement is, in response header Set-Cookie should…
11
votes
4 answers

Nginx does not re-resolve DNS names in Docker

I am running nginx as part of the docker-compose template. In nginx config I am referring to other services by their docker hostnames (e.g. backend, ui). That works fine until I do that trick: docker stop backend docker stop ui docker start…
11
votes
2 answers

How can I match any path containing a dot with nginx?

I am trying to implement a proxy using the nginx configuration The idea is to have a http server hosting my website (my SPA). and having one route on my http server pointing to another api. this is my nginw configuration file…
netlyonel
  • 155
  • 1
  • 2
  • 8
11
votes
2 answers

Run multiple django project with nginx and gunicorn

I am using Ubuntu 18 servers and using nginx with gunicorn I follow Digitalocean tutorial for server setup. I successfully did for one project but now I need to run multiple projects under by server. Here is my gunicorn setup command: sudo nano…
Antu
  • 2,197
  • 3
  • 25
  • 40
10
votes
1 answer

Nginx location's regex, is escaping the forward slash needed?

Nginx uses the PCRE engine for evaluating regular expressions, the documentation state that / delimiter is not used so we don’t have to escape the forward slash / in an URI as we may do in a standard regex. An example of a valid nginx regex is…
intika
  • 8,448
  • 5
  • 36
  • 55
10
votes
2 answers

Nginx HTTP not redirecting to HTTPS 400 Bad Request "The plain HTTP request was sent to HTTPS port"

I'm running nginx in docker. HTTPS works fine but when I explicitly make HTTP request I get the following error 400 Bad Request The plain HTTP request was sent to HTTPS port nginx.conf is as follows worker_processes auto ; events {} http…
Omair Nabiel
  • 1,662
  • 2
  • 12
  • 24
9
votes
1 answer

Error trying to run nginx using docker-compose with custom conf.d

I'm trying to set up a web server with multiple containers - but starting with a simple setup for my reverse proxy. My docker-compose.yml looks as follows: version: '3' services: reverse-proxy: container_name: reverse-proxy …
Manu Matute
  • 373
  • 1
  • 3
  • 12
9
votes
2 answers

Optimal Nginx config to handle thousands of request within seconds

What are the optimal settings for Nginx to handle LOTS of requests at the same time? My server is configured with Nginx and PHP7.3 on Ubuntu 20.04 LTS. Application that is running is build with Laravel 7. This is my current config: location ~…
user1469734
  • 851
  • 14
  • 50
  • 81
9
votes
0 answers

Using variable in nginx conf

This works in my Nginx config: # This works proxy_pass http://GitLab-CE:9080; ... but this does not: # does not work set $upstream_gitlab GitLab-CE; proxy_pass http://$upstream_gitlab:9080; This was copied from a different…
eric.frederich
  • 1,598
  • 4
  • 17
  • 30
8
votes
1 answer

Why does NGINX load balancer passive health check not detect when upstream server is offline?

I have an upstream block in an Nginx config file. This block lists multiple backend servers across which to load balance requests to. ... upstream backend { server backend1.com; server backend2.com; server backend3.com; } ... Each of…
Kuyashii
  • 360
  • 1
  • 4
  • 21
8
votes
2 answers

nginx ingress controller forward source ip

I have setup an ingress for an application but want to whitelist my ip address. So I created this Ingress: apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: cert-manager.io/cluster-issuer: letsencrypt …
bramvdk
  • 1,347
  • 4
  • 21
  • 31
8
votes
0 answers

How to setup Nginx reverse proxy for multiple containers with each container having its own Nginx server

I've a VPS on which I want to deploy multiple web applications (for which I've already read posts and they're perfect when we have directly sub container). I want to manage each web application having its own nginx to route to its sub domains and…
8
votes
2 answers

Ignoring cookies list efficiently in NGINX reverse proxy setup

I am currently working/testing microcache feature in NGINX reverse proxy setup for dynamic content. One big issue that occurs is sessions/cookies that need to be ignored otherwise people will logon with random accounts on the site(s). Currently I…
Mecanik
  • 1,539
  • 1
  • 20
  • 50
8
votes
1 answer

How to redirect www to non-www using certbot for HTTPS & nginx

I'm trying to redirect www to non-www but it doesn't work. I've tried various answers from similar questions but those haven't worked. I have SSL cert using certbot for 3 domains example.com, www.example.com and admin.example.com. This is my…
Grimbox
  • 203
  • 2
  • 7