Questions tagged [nginx-config]
2020 questions
8
votes
1 answer
conditional routing with nginx based on referer
I need to route traffic based on the http request origin. I have two environments and we need to redirect every http request for "/us-en" to Environment1 and others to Environment2 using "$http_referer".
Redirection based on location…

Debarshi DasGupta
- 351
- 2
- 5
- 21
8
votes
0 answers
How to run php-fpm master process as non root user?
How do i run php-fpm master process as non root user
root 10275 0.0 0.5 192856 23104 ? Ss Nov20 0:01 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)

Dasarathi Swain
- 861
- 1
- 7
- 16
8
votes
2 answers
nginx logs for location
Need some help in setting up nginx logs so that they are not duplicated.
My configuration is as following. What I would like to achieve is that all logs for say, http://example.com/app goes to file app.access.log and logs for rest of the site goes…

mesibo
- 3,970
- 6
- 25
- 43
8
votes
1 answer
Kubernetes Ingress Nginx loading resources 404
Hy
We're trying to get our website working on kubernetes (running in a container using nginx). We use ingress to route to the site, here is our configuration:
nginx-conf:
server {
listen 80;
location / {
root /usr/share/nginx/html;
index…

Peter Wyss
- 395
- 2
- 16
7
votes
1 answer
Nginx ssl_session_cache difference between shared:SSL and shared:MozSSL?
When setting ssl_session_cache in Nginx I often see examples set it as one of the two options:
ssl_session_cache shared:SSL:10m; or ssl_session_cache shared:MozSSL:10m;
What is the difference between these two?

pyCthon
- 11,746
- 20
- 73
- 135
7
votes
3 answers
502 Bad Gateway error - upstream sent too big header while reading response header from upstream
I'm using wordpress in Google App Engine. When I make a POST API, getting an Error : "upstream sent too big header while reading response header from upstream". which returns 502, Bad Gateway, nginx
The data(JSON) i'm sending in POST API is around…

Dev
- 123
- 1
- 1
- 5
7
votes
3 answers
Nginx bypass cache if upstream is up and use cache if down
To bypass cache if upstream is up (max-age 1) and use cache if down (proxy_cache_use_stale) I created following config:
proxy_cache_path /app/cache/ui levels=1:2 keys_zone=ui:10m max_size=1g inactive=30d;
server {
...
location…

Anatoli
- 889
- 2
- 15
- 33
6
votes
1 answer
default_type application/octet-stream in nginx.conf file
In the default nginx configuration file i see that the default_type is set to application/octet-stream. I understand the MIME types but I do not understand why we are setting a default type. What is the significance of this configuraion? Can someone…

Adnivas
- 103
- 2
- 7
6
votes
2 answers
How to properly configure Nginx caching for REST API?
Case:
I have REST API via HTTPS and I want to configure a basic caching proxy service on my host to cache API requests and get the same information faster, as usual.
I have the following configuration of Nginx:
proxy_cache_path /tmp/cache levels=1:2…

Timur Nurlygayanov
- 1,095
- 2
- 11
- 24
6
votes
1 answer
What is the difference between access_by_lua and content_by_lua to refer to a lua script in nginx.conf?
I am currently confused. My code works on each request sent to location /.
########nginx.conf
server {
listen 8000;
server_name localhost;
lua_code_cache on;
location / {
content_by_lua_file…

Ishanu Chakraborty
- 61
- 1
- 2
6
votes
1 answer
Set up nginx to use multiple ssl certificates without having multiple servers
I'm trying using nginx for having multiple ssl certificates without having to create a server for each one of them.
So I have a reverse proxy built and it will have multiple different sites with the same domain running on it. Is it possible to have…

hal-tcp
- 63
- 1
- 1
- 3
6
votes
4 answers
How do I configure nginx for WordPress REST API in sub-folder?
I am trying to set up multiple Wordpress sites in sub-folders under our domain (ie not multi-site), but I have difficulty configuring the REST API endpoints. For example, this endpoint works…

Jannie Theunissen
- 28,256
- 21
- 100
- 127
6
votes
0 answers
How to add ngx_http_ssl_module to the compiled version of nginx
I have a problem with setting ssl on my server. I have configured nginx with the modpagespeed (compiled version from https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source)
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in…

Przemo
- 61
- 2
6
votes
2 answers
nginx add_header Set-Cookie expires not working
I am trying to set up an nginx server that sets certain parameters in a cookie when hit on a certain location.
I have the following configuration that puts the parameters in the cookie but the expiration does not work. This is my…

penguin
- 61
- 1
- 1
- 2
6
votes
1 answer
Send nginx logs to both syslog and stdout/stderr
By default, my nginx server is plotting logs to stdout and stderr.
I want to forward logs to my syslog server, and I'm doing so successfully, from nginx.conf:
server {
...
error_log…

Mugen
- 8,301
- 10
- 62
- 140