Questions tagged [nginx-location]

Questions related to nginx location directive should use this tag.

1424 questions
10
votes
3 answers

Serve protected media files with django

I'd like Django to serve some media files (e.g. user-uploaded files) only for logged-in users. Since my site is quite low-traffic, I think I will keep things simple and do not use django-sendfile to tell Nginx when to serve a file. Instead I'll let…
user2496550
  • 573
  • 1
  • 8
  • 18
10
votes
2 answers

Jenkins/Nginx - Double prompted for basic auth, why? Why is there an internal Jenkins auth?

Below is my nginx configuration file for Jenkins. Most of it is exactly as per I've read in the documentation. Config file: upstream app_server { server 127.0.0.1:8080 fail_timeout=0; } server { listen 80; listen [::]:80 default…
skålfyfan
  • 4,931
  • 5
  • 41
  • 59
9
votes
0 answers

Nginx - The connection was reset?

I have Ngnix installed on my host at Linode. I have the config below: server { listen 80; server_name example.co.uk www.example.co.uk; location / { root /usr/share/nginx/html; index index.html index.htm; …
Run
  • 54,938
  • 169
  • 450
  • 748
9
votes
1 answer

Nginx - location with root in other directory and PHP

I tried to set a location similar as "Apache Alias" with Nginx but I don't able to process PHP script in this folder. Here is my folder structure (for Dev environment): /var/www +- dev/public/ <-- This is my normal Web root : "/" | +- assets/ | …
Akarun
  • 3,220
  • 2
  • 24
  • 25
9
votes
2 answers

nginx configuration with multiple location blocks

I'm trying to configure nginx to serve 2 different php scripts from 2 different location. The configuration is as follows. I have a Laravel installation which resides in /home/hamed/laravel in which its public directory should be served. I have…
2hamed
  • 8,719
  • 13
  • 69
  • 112
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
2 answers

NGINX Reverse Proxy and Access-Control-Allow-Origin issue

I'm configuring an NGINX Reverse Proxy. On the browser I go to: client url: https://www.hollywood.com Then the web page above needs to do requests to: server url: https://server.hollywood.com/api/auth/login This is the configuration corresponding…
8
votes
2 answers

Nginx allow only root and api locations

I have a server configured as a reverse proxy to my server. I want to reject all the requests except to two locations, one for root and another the api root. so the server should only allow requests to the given paths example.com/ (only the…
user5539517
8
votes
2 answers

How to Proxy Pass from / to /index.html

I'm currently working on a JS Project, that uses the url path. Now if I go on my website with example.com/, the JavaScript won't work, because I actually need example.com/index.html. I'm already using an reverse proxy to proxy pass to two…
Alexander Pilz
  • 180
  • 1
  • 6
  • 16
8
votes
2 answers

Serving remote static files with symfony3

I have a problem with my Nginx configuration. I have 2 servers, one with nginx and one with my webApp in symfony3. Here is my configuration : location /portal/mysite/ { set $frontRoot /srv/data/apps/mysite-portal-stag/current/web; set…
Daniel E.
  • 2,440
  • 1
  • 14
  • 24
8
votes
2 answers

Nginx location / vs /artifactory

I am looking at the nginx configuration to set up a docker repository ########################################################### ## this configuration was generated by JFrog Artifactory…
user_mda
  • 18,148
  • 27
  • 82
  • 145
8
votes
1 answer

How does if condition work inside location block in nginx conf?

I have read https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ I want to check if my rails application has already added a header (Access-Control-Allow-Origin) and if it hasn't then add the header. The examples here have tried to…
Abhishek Kumar
  • 674
  • 1
  • 6
  • 15
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
7
votes
1 answer

NGINX health check requires an upstream

I have a location like: location / { set $api_name "Web"; proxy_intercept_errors on; set $upstream upstream_a; if ( $kms_in_cookie != "not_set" ) { set $upstream $kms_in_cookie; } if ( $upstream_in_cookie != "not_set" ) { set $upstream…
Lei Zhao
  • 71
  • 3
7
votes
0 answers

nginx try_files with add_header

Can someone explain this? I have an nginx server block with this snippet in it: location / { try_files $uri $uri/ /index.html; } Basically, I'm using this to serve an Angular SPA. It works well and great. Now I wanted to append…
Rajshri Mohan K S
  • 1,557
  • 17
  • 30
1
2
3
94 95