Questions tagged [nginx-location]

Questions related to nginx location directive should use this tag.

1424 questions
2
votes
0 answers

Dockerfile: FastCGI Throws Primary script unknown" while reading response header from upstream error

I am creating a laravel project using Docker Compose, using the following setting: docker-compose.yml version: '2' services: app: build: context: ./ dockerfile: app.dockerfile working_dir: /var/www volumes: -…
Jeremy
  • 2,516
  • 8
  • 46
  • 80
2
votes
2 answers

Serve .min.css files first nginx

I need to configure nginx server. I have folder with css files there are files some_file.min.css but in html website ask for some_file.css. I need to redirect this request to *min.css and if minified file doesnt exist return normal .css file…
Skyfall174
  • 41
  • 7
2
votes
1 answer

Allowing only local network access in NGINX

I have a single physical server running several server blocks in nginx corresponding to different subdomains. One of them I'd like to be only accessible from devices on the same local network as the server. I know theoretically this can be done with…
Sean
  • 3,002
  • 1
  • 26
  • 32
2
votes
1 answer

NGINX location fallback to Symfony

I'm working on a legacy API project written in pure PHP and now trying to move it to Symfony 4 and need to make some changes to the NGINX configuration. I am required to keep both the old and the new endpoints working at the same time, so my plan is…
William J.
  • 1,574
  • 15
  • 26
2
votes
0 answers

rewrite displayed url without actual redirect

I'm trying to change displayed urls to keep all sub domain urls relative to the main domain, example maindomain.com/some_page would be served from sub.maindomain.com/some_page but to keep the displayed url in browser to…
RmK
  • 117
  • 7
2
votes
1 answer

How to enable different SSL certificate for different location using Nginx?

Suppose I have only ONE domain name "example.com". I want to enable SSL certificate using "A.crt" when visiting "https://example.com/api/A" and using "B.crt" when visiting "https://example.com/api/B". How can I achieve this with Nginx configuration?…
2
votes
1 answer

proxy_pass return redirect in nginx

I am just a beginner who is currently studying nginx. I have questions while using nginx's proxy_pass feature, so I have questions. My website is test.com (just example). http://test.com/aaa (This is example address) -> aaa makes return to…
IllegalKim
  • 23
  • 1
  • 4
2
votes
1 answer

How to use NGINX to forward the request to Docker Microservice

I wanted to use NGINX as a reverse proxy to forward the request to microservices. Both NGINX and Microservices are hosted on docker container. Below is my nginx.conf file worker_processes 1; events { worker_connections 1024; } #test …
Anand Deshmukh
  • 1,086
  • 2
  • 17
  • 35
2
votes
0 answers

Nginx add argument to every request from parent argument

I have this URL http://www.example.com/?jenkins=FCPI-526-preview-branch and I would like every asset i.e. http://www.example.com/css/app.css to also have the exact same argument as the parent request arguments. I have tried the following: Setting a…
2
votes
0 answers

nginx wildcard subdomains to different roots

i want to support all level subdomains to "domain.com" for my configuration. That's possible with: server_name "~^(?.+)\.domain\.com$"; My root looks like this: set $subDirectory subdomains/$sub/; set $root…
2
votes
2 answers

nginx location match rule, without matching trailing characters

I have the following rule: location /foo { Which matches well for the following examples: mydomain.com/foo mydomain.com/foo/ mydomain.com/foo/bar?example=true However it is also matching for mydomain.com/foobar I don't want it to match to that…
Aeternata
  • 21
  • 4
2
votes
1 answer

How can I set Host as $upstream_addr in Nginx

I have the following config below on Nginx.conf http { log_format my_upstream '$remote_addr [$time_local] "$request" $status' '"$upstream_addr" $upstream_response_time $upstream_http_etag $host $http_host'; access_log…
Bhaskar
  • 21
  • 1
  • 5
2
votes
1 answer

nginx rewrite to index.php?q=$uri

I have to update a nginx host so all requests to an alias are rewritten to /alias_path/index.php?q=$uri. But now all the assets are no longer available. This is my current configuration. And I'm getting closer, but when I am uncommenting the last…
Thomas Venturini
  • 3,500
  • 4
  • 34
  • 43
2
votes
1 answer

Share directives between location blocks in nginx

I have an nginx location block that should be delegated to uwsgi backend and provide http --> https redirection, so it goes as follows: location ~ ^/(api/v1) { if ($http_x_forwarded_proto != 'https') { rewrite ^…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
2
votes
0 answers

How to make streaming MP4 from reverse proxy?

I try to make little youtube. I have two servers. Backend server Ubuntu16. Server has application + mp4 files. Django + uWSGI + NGINX user www-data; worker_processes auto; pid /etc/nginx/logs/nginx.pid; events { worker_connections…
alex_devPY
  • 21
  • 1
  • 4