Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
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
1 answer
Nginx access_by_lua_block not executed in case of 3XX redirects
I am using the access_by_lua_block in my nginx configuration to add/modify custom request headers (let's say ngx.req.set_header("foo", "bar")). I am accessing these headers within the header_filter_by_lua_block as ngx.var["http_foo"] just before…

Vinay Mundada
- 317
- 3
- 13
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
4
votes
1 answer
Why ignores nginx my "auth_basic off" for sub-path location directive?
Nginx (docker image, 1.17.2) requires a basic authentication for a subpath. Although my config says otherwise for https://example.org/subpath:
// /etc/nginx/conf.d/mysetup.conf
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
server {
…

pico_prob
- 1,105
- 10
- 14
4
votes
1 answer
Why try_files directive missing slash between root and filename?
I'm trying to set up Nginx to work as reverse proxy, but also handle single static page (greeting) by its own:
root /usr/share/project/;
location = / {
try_files index.html =404;
}
This config always return 404. When I tried to figure out what…

Dmitry Dmitriy
- 93
- 6
4
votes
2 answers
Use Environment Variable or Parameter in nginx.conf
I try to add a proxy_pass in the nginx.conf like
location /example/ {
proxy_pass http://example.com;
}
But instead of hard coding http://example.com in the conf file I want to have this value in an environment variable.
How can I use…

Simon Martinelli
- 34,053
- 5
- 48
- 82
4
votes
2 answers
How to run c++ CGI script on NGINX server
I have written below lines in configuration file created in /etc/nginx/conf.d named as "helloworld.local.conf".
server{
listen 80 default_server;
server_name hello_world;
location / {
root /var/www/helloworld;
…

Atul Singh jadaun
- 55
- 1
- 9
4
votes
1 answer
Nginx configuration for multiple static sites on same server instance
I have three static sites. I am using Vue 2 and running build for each folder.
I want to host all three static files on the same server instance. Right now I don't have domain so i want to host on server's IP itself.
I have folder in html/www…

wazz
- 92
- 1
- 4
- 11
4
votes
0 answers
how to rewrite response based on request body content in nginx?
I have requirement where i need to have a rewrite the response with static context in nginx based on content from the request body say "fruit":"apple",
The nginx location with rewrite config as mentioned below,
o
tried referring to nginx…

Bharathan Kumaran
- 981
- 10
- 22
4
votes
0 answers
Nginx + Docker. 504 Gateway Timeout
I've been struggling for a bit on this and I'm starting to get depressed...
I'm running a droplet on DigitalOcean with Ubuntu 18.10.
I've used Docker to serve my different service (nuxt, socket.io, nginx, nodejs)
And I've used Nginx to revese proxy…

Clément K
- 61
- 1
- 4
4
votes
3 answers
Nginx location match regex for special characters and encoded url characters
I've been trying so many things today and I am just not winning. I have one file in my site which got created by accident with a special character in it. As a result Googlebot has stopped crawling for 3 weeks now and Webmaster tools / Search console…

MitchellK
- 2,322
- 1
- 16
- 25
4
votes
1 answer
Cant find interface eth0 for vrrp_instance VI_1
Currently, I am trying to run KEEPALIVED with NGINX on my machine. My use-case includes monitoring the failover behavior for NGINX server because any one instance can go down and I need to have other instance alive to serve the incoming…

Pratisha Paul
- 91
- 1
- 5
4
votes
1 answer
NGINX command not found
NGINX was built from source using the latest stable build on a debian 9 server. sudo nginx command cannot be found. The NGINX install is located in /usr/local/nginx. How can I configure my server to follow the standard sudo nginx [command] rules? I…

Rhys
- 91
- 1
- 2
- 7
4
votes
0 answers
Nginx root inside a docker container
I'm trying to run nextcloud docker in a subdir pointing /var/www/nextcloud in a nginx docker.
But no matter what I do, nginx continues to try to serve the /var/www/nextcloud/nextcloud when I access it.
This is the ngix.conf (notice the root…

jbssm
- 6,861
- 13
- 54
- 81
4
votes
1 answer
open() "" failed (2: No such file or directory)
When I request a link http://abc.example.com/images/default-thumbnail.jpg a 404 error occurs while seeing the log file output [error] 1244#0: *1 open() "/tmp/upload-dir/images/default-thumbnail.jpg" failed (2: No such file or directory),
But in fact…

Terrence
- 158
- 2
- 4
- 14