Questions related to nginx location directive should use this tag.
Questions tagged [nginx-location]
1424 questions
3
votes
0 answers
How to print request_body and response_body from NGINX
I want to print the request_body and response_body from NGINX.
I try to implement a few of the solution that I have learned from here
But it was not working in my case. Is there some additional changes that I need to configure in my NGINX.conf…

Anand Deshmukh
- 1,086
- 2
- 17
- 35
3
votes
1 answer
nginx Content-Security-Policy Header still blocking bootstrapcdn
I have the following in my nginx.conf
add_header Content-Security-Policy
"default-src 'self';
img-src 'self' 'unsafe-inline' 'unsafe-eval' data: *.printfriendly.com *.w.org *.gravatar.com *.vimeocdn.com;
script-src 'self'…

Kevin
- 2,684
- 6
- 35
- 64
3
votes
1 answer
How do I serve old xml sitemap after domain swap via nginx config
I've recently swapped the domain extension of a site from .xyz to .com and I'm using a rule in my nginx config to 301 traffic from the old domain to the new one.
server {
listen 8080;
server_name example.xyz www.example.xyz;
return 301…

user1803975
- 345
- 1
- 4
- 14
3
votes
1 answer
nginx is not passing mime type 'json' to Odoo RPC call at url 'jsonrpc'
I have a Python script that can log into Odoo using RPC calls to the jsonrpc url. The scripts works if I run it on the Odoo server and point it directly to Odoo.
login_parms = {
"id": conversation_id,
"jsonrpc": "2.0",
"method": "call",
"params":…

Pengo
- 470
- 1
- 5
- 17
3
votes
1 answer
Nginx Rule to Block Specific URL
Need some help in writing a rule to block the following request
The url in question is:
www.somesite.com/catalogsearch/result/?q=downloader
I have tried the following, but this does not work
location ^~ catalogsearch/result/?q=downloader {
deny…

user1517598
- 111
- 1
- 4
- 11
3
votes
0 answers
GeoIP module not able to fetch geo_country_code value in nginx
I am using nginx GeoIP module to get the country location of the server.
The nginx -V command provide me with the list of modules installed and I am already getting --with-http_geoip_module in the list. The next step was to make changes in…

SHUBHAM DHANUKA
- 31
- 1
3
votes
1 answer
how to config nginx docker container to recognize localhost application in different port?
Setup:
All following are running on my Mac OS:
localhost:8089 a nodejs REST api runing in my local, OUTSIDE of the nginx container, stand alone!
locahost:80 nginx docker container
I was able to serve static file inside the nginx docker container,…

ey dee ey em
- 7,991
- 14
- 65
- 121
3
votes
1 answer
Nginx subdirectory root with PHP
I'm running nginx in a docker container. I want to have a subdirectory /web/ to access my personal files and projects. It should also support php.
Below is what I'm running with but domain-a.com/web keeps resulting in a 404. PHP is confirmed working…

Bob
- 1,066
- 2
- 14
- 28
3
votes
0 answers
Nginx make any URL work with or without a trailing slash
I want any directory to serve up either index.html or index.php – whether a trailing slash was given or not.
Right now my directories will load when a trailing slash is given, but not without.
# Works
localhost/mydirectory/
# Does not…

Justin Breen
- 126
- 3
- 11
3
votes
2 answers
Nginx. Laravel. How to set up multiple endpoints in subfolders
I have such a project structure
/public/laravel_app/index.php — Laravel index file
/public/index.php — CraftCMS index file
I want to load CraftCMS app at
https://
and Laravel app at…

D.R.
- 2,540
- 3
- 24
- 49
3
votes
2 answers
Nginx conditionally rewrite uri
I use nginx as a reverse proxy for multiple Rails apps (using Nixy). I need to rewrite some requests to inject a string in front of url, if is missing.
For example:
If I have http://proxy_ip/app_name/some/root I don't want to modify anything, but if…

kitz
- 879
- 2
- 9
- 24
3
votes
1 answer
How to configure nginx for a RESTful API?
I have a RESTful web service which exposes an interface such as :
GET /api/v1/films/:id/thumb
PUT /api/v1/films/:id/thumb
...
The Web Server is composed of a nodejs cluster behind a nginx reverse proxy.
I am now trying to configure nginx proxy and…

M. Timtow
- 343
- 1
- 3
- 11
3
votes
1 answer
How to redirect in nginx if request URI does not contain certain words
I'm using nginx to serve static news-like pages.
On the top-level there is
https://example.com/en/news/ with an overview of the articles.
Individual items have a URL similar to this: https://example.com/en/news/some-article
All URLs contain the…

aix
- 1,063
- 2
- 13
- 24
3
votes
1 answer
Nginx try_files loads blank page when passed with variable path
I am setting up nginx to work with a React SPA. The page loads fine when I do not include a variable path (/rsvp/). But when I try (/rsvp/S0mEtH1NG), it will download the index, manifest, css files... but it doesn't actually apply those things to…

RollinRight
- 105
- 1
- 8
3
votes
1 answer
Serving angular SPA and another index.html from nginx
I have a SPA and serving it from Nginx which works fine. I also have an simple index.html inside a sub-folder.
Spa links to index.html for displaying a sub application which is simple html with it's own css/js. When trying to browse the subfolder…

Chirdeep Tomar
- 4,281
- 8
- 37
- 66