Questions tagged [nginx-config]

The tag has no usage guidance.

0
votes
0answers
5 views

Nginx reverse proxy config whitelist IP

I am using Nginx reverse proxy with Kubernetes services. Config is following: events { } http { upstream my-service-3000 { server my-service:3000; } ...
0
votes
1answer
15 views

How to configure nginx to refuse connection from a suspicious host?

I use Nginx to handle HTTP requests. During access log inspection, I found a lot of suspicious requests from the same IP address. I'd like to configure Nginx to refuse connections from hosts like that ...
0
votes
0answers
7 views

Cannot load site js resources when using non root location with nginx

I'm hosting a web server with nginx. The following nginx configuration file works fine: server { listen 443 ssl; server_name $hostname; ssl_certificate /app/cert.pem; ...
0
votes
0answers
10 views

Nginx bypass cache for specific uri

To bypass cache for specific uri (that contains for example latest or 1.0) I set up following configuration: location ~* ^/api/service/([a-zA-Z0-9.-]+)$ { return 301 $scheme://$http_host$uri/...
0
votes
0answers
11 views

nginx Rewrite convert issue

I am trying to convert this rewrite rule to nginx: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^(.*)\.html(.+) [OR] RewriteCond %{...
0
votes
1answer
31 views

ansible-playbook is skipping the task [on hold]

I am trying to setup the NGINX in my server using Ansible with the following playbook: --- - name: Setup nginx hosts: web remote_user: * become_user: * become: true gather_facts: True ...
0
votes
1answer
14 views

invalid_referer syntax for if in nginx

I use this in my nginx.conf where ${WWW_URL} is variable with my web app url location ~* \.(jpg|png)$ { valid_referers none blocked www.${WWW_URL} ${WWW_URL}; if ($invalid_referer) { # line ...
0
votes
0answers
12 views

How to add and keep current a JWT token to client requests using nginx

I have a client that can only make requests without authentication information. I would like to use nginx or a similar proxy solution to add OAuth authentication to these client requests. I can add ...
0
votes
0answers
14 views

Nginx alias configurations nested location with try_files argument error for php slim and laravel

server { listen 80; client_max_body_size 3M; root /var/www/html/project/project_bb/public; index index.php index.html index.htm; server_name project.loc; access_log /var/...
0
votes
0answers
19 views

nginx redirection from webserver to API in app server, but API is running on different ports

I have two web pages are running at server IP1 Party A will be accessible via http://IP1:10009/web/example/PartyA/ and Party B will be accessible via http://IP1:10012/web/example/PartyB/ The app ...
-1
votes
0answers
11 views

Ngnix and domain name resolving

events { worker_connections 1024; } http{ server{ listen 80; server_name www.nodeapp.com; location / { proxy_pass http://127.0.0.1:4200; } } } ...
0
votes
0answers
13 views

Nginx - Is it possible to completely hide the html page and/or bookmark link from the browser address bar?

I have a website hosted via the latest version of Nginx running on a Centos 7 server. Is it possible to hide any html page names and any page bookmark links from the browsers address bar? When I ...
-1
votes
1answer
41 views

nginx redirection to another server

I compiled the nginx 'echo-nginx-module' module to log the request body. My goal is to log and reverse proxy all the traffic coming to nginx to another DNS. I am using proxy_pass to redirect the ...
0
votes
0answers
15 views

Wordpress+Nginx - GeoIP Redirect returns 404

I have the following configuration on my Nginx conf file, on my webserver serving wordpress. There are several things I want to achieve by order. 1) If user is from selected countries e.g ...
0
votes
0answers
12 views

Redirecting to same page in case of resource not found - Nginx

I have an use case where if page is refreshed, it should redirect back to the same page. For example let's say I am on example.come/user/123. Now if I refresh the page, I should be redirected to same ...
0
votes
0answers
11 views

How to set ssl_verify_client based on QUERY_STRING in nginx?

I'm trying to set ssl_verify_client based on QUERY_STRING in the URL. In our environment we sometimes need our users to choose a cert (for smart card logins) and sometimes we don't. Then the reverse ...
0
votes
0answers
36 views

nginx subdomain to subdirectory

How to make subdomain goes to sub directory with reverse proxy like download.mikrorik.com goes to xnxx.works/download and fetch data from download.mikrotik.com my config so far server { listen 80;...
0
votes
2answers
16 views

Nginx Rewrite URL Rule having special character(#) for Page section

I need help in rewriting the URL in nginx configuration which should work as below : /products/#details to /produce/#items but it is not working as # is creating a problem. Note : # in the URL ...
0
votes
1answer
41 views

How to avoid response body on http 304 in nginx?

I am using nginx version 1.10.3 to serve files to browser. In my server logs I am seeing response body on 304 response. How to avoid that? Nginx log: "GET /test/testfile.js HTTP/1.1" 304 2476 "-" "...
0
votes
1answer
25 views

Nginx: redirecting multiple http servers to SSL: config not working

I'm trying to put an nginx together with the following setup: I have two http servers running on my localhost. One listening on port 8080, the other on port 8081. Both should be served through ...
0
votes
1answer
28 views

The reverse proxy that configured Nginx for HTTP traffic appears 403

I'm trying to use Nginx as a reverse proxy in and centos 6.9_64 environment where clients connects to my server (http://www.51ti.vip). Nginx will forward all requests to other backend server. The ...
0
votes
0answers
16 views

Rewrite in nginx to a pattern uri

I'm trying to implement a redirection using a pattern url in order to redirect to that file that will be change with any control but following a pattern. I have this code: location ~ ^/file { ...
-2
votes
1answer
33 views

Install Laravel with nginx in Subdirectory

I try to enable PHP for only one subdirectory (the laravel directory) but I didn't manage to get this working. NGINX is always saying 404 File not found or php says "no input file specifed". What am I ...
0
votes
0answers
13 views

Getting 403 Forbidden in nginx

I am new nginx and I have configured the domain using nginx now the problem is am getting 403 Forbidden error for the domain example.com but am able to access example.com/index.html Here is my config ...
0
votes
0answers
12 views

Pass values from one location to another location in nginx

I have a use-case to set one variable in a location block and then use it in another location block. The value of the variable has to be set inside a location block hence I have no option to set a ...
0
votes
1answer
31 views

how to change nginx config file for angular application

My angular application is running on nginx server . When I type “http://**.8.100.248:30749” it show nginx is running. (Showing default index.html). But my application is present in html folder ...
0
votes
0answers
16 views

NGINX location route all of subdirectory to a single file

I was wanting to redirect any urls from /path/[any numbers] to show the same page. (for instance /path/index.php) I tried to use a simple regex in a location block in the conf file but don't really ...
1
vote
0answers
9 views

nginx config - negative condition

I make HTTP authorization in nginx config for all files, exclude index.php: server { listen 80; root /var/www/site; index index.php; charset utf-8; location ~ /(?!index.php) { ...
0
votes
1answer
22 views

nginx configuration to provide dynamic error pages

I have an nginx server setup that serves as is used to for proxy and serving static content. The static contents are based on multiple react apps. What I want to do is replace the default error pages ...
2
votes
1answer
26 views

Allow php value to only work in a subdirectory

In my php.ini, I have disabled allow_url_fopen. I would like to enable it for my /example directory as shown below, but it does not work. However, if I move the directive to allow it from /example to ...
0
votes
0answers
12 views

nginx forwarding on access from a specific ip

I have a quick question about the Nginx web server. I have already searched for the problem, but have found nothing. If someone wants to access my website, with a specific IP, I want to redirect to ...
1
vote
2answers
99 views

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 ...
1
vote
0answers
14 views

Nginx serve static files only in subdirectories

I have image path /uploads/{some user id}/0a17f689-b7d5-4592-a16a-85feb1ae00c7.gif. I want to serve this kind of path with nginx. How can I make nginx look for the file in all directories that match ...
0
votes
0answers
14 views

Variable $content_length clarification in Nginx

I was going through variables list maintained by nginx at http://nginx.org/en/docs/varindex.html. I was trying to figure out why nginx maintains $content_length if it is same as “Content-Length” ...
0
votes
3answers
133 views

Retain URL in browser with Flask redirect

I have a Bokeh server application deployed on Heroku, with multiple styles that result in cumbersome URLs. For example: https://invlabs-bokehserver.herokuapp.com/avyview?style=snowpacktracker I am ...
0
votes
1answer
55 views

Docker prom/Prometheus container exits

when i run this command it creates the docker container but shows in exit status and i am not able to get it started my goal is to be able to replace prometheus.yml file with a custom prometheus.yml ...
0
votes
0answers
21 views

Understanding NGINX default caching

I have a NGINX config with different locations. They all return an individual index.html. The index.htmls are built with each deployment. They include script tags for JavaScript files that are ...
1
vote
1answer
13 views

nginx rewrite not working - returning 404

I'm trying to rewrite : http://example/test/ -> http://example/new/ http://example/test/check -> http://example/new/check location ~/test/(.*)$ { rewrite ^/new/$1?$args permanent; } What am I ...
0
votes
1answer
10 views

Nginx change root directory if specific query_string is specified in config

I want to change change root directory if specific query_string is given in config, server { listen 80; server_name www.test.com; if ( $query_string = "abc") { set $variable "abc"; } if ( $...
0
votes
1answer
27 views

NGINX configurations not redirecting non-www to www

I have a NodeJS app running on port 3000 on an Ubuntu 16 server hosted on an AWS EC2 instance. I want NGINX to redirect each of the following addresses to https://www.example.com: http://example.com ...
0
votes
1answer
26 views

SecContentInjection is not yet supported

I am getting below error when using ContentInjection rule vi /etc/nginx/nginx.conf nginx -s reload 10:26:25 [notice] 118#118: ModSecurity-nginx v1.0.0 10:26:25 [emerg] 118#118: "modsecurity_rules"...
0
votes
0answers
19 views

How to get NGINX to accept http://npomf/ as a proxy_pass?

I am trying to setup Npomf on my vps and i run into this error when doing the setup instructions. I get an error at line 61 of my config (hastebin). I cannot seem to resolve this proxy_pass issue, yet ...
1
vote
1answer
19 views

nginx: how to get a server for the case of no Host: header?

I've got a special server {} block for the case of people who use an IP address in a host header (server_name ~^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+;) and that works fine. I'd like a different server block ...
0
votes
0answers
10 views

Nginx degrade connection from socket to http

I have been trying to degrade my socket connection to HTTP in nginx which is not happening. MY nginx config for for socket connection is location / { if ($http_cookie !~* "session") { ...
1
vote
0answers
27 views

Nginx internally call another request and return that request data

I am using nginx and lua to parse my rest api (https://openresty-reference.readthedocs.io/en/latest/Lua_Nginx_API/) . I am trying to internally call another api inside my rest call which is a ...
0
votes
1answer
27 views

How to override nginx in AWS Beanstalk environment

There are many situations where we need to override nginx conf in AWS beanstalk environment. Set a max file attachment Force http to https Set different cache expires for different static resources ...
0
votes
2answers
44 views

How to disable ssl certificate and only used to forward traffic on port 443 in Nginx?

Host A has https service serviceA and provides two IP for high availability。 e.g. Bose [ip1:443] and [ip2:443] are routed to the serviceA. Host B (do not has ssl_certificate and ...
2
votes
1answer
19 views

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 ...
0
votes
0answers
28 views

Nginx proxy infront of AWS Internal ALB:upstream timed out (110: Connection timed out) while connecting to upstream

We have two drupal apache web servers behind ALB. Nginx proxy_read_timeout as 300 no other proxy_connect_timeout proxy_send_timeout keepalive_timeout has been defined/configured. Occasionally ...
0
votes
0answers
20 views

Split Play 2 Application into subdomains using Nginx as reverse proxy

I have a Play 2.4 application which runs on localhost:9000. I was able to proxy it to port 80 using proxy_pass server_name example.com; location / { proxy_pass http://127.0.0.1:9000$...