Questions tagged as ['nginx']

Nginx ("eNgine x") is a lightweight, high-performance HTTP server, reverse proxy, TCP stream proxy and mail proxy, released under a BSD-like license.
Score: 0
How to configure Windows>Vmware>Docker>nginx so I can access http
cn flag

On my PC I have this stack:

  • Microsoft Windows [Version 10.0.19042.1110]
  • VmWare Player 16.1.2 build-17966106 installed in windows
  • CentOS Stream 8 installed in a VM
  • Docker 20.10.7 installed on CentOS
  • nginx latest launched via docker run -p 8000:80 nginx

How can I access nginx from Windows chrome browser?

Within the VM it works - I can browse to http://localhost:8000 and see the nginx landing page, but s ...

Score: 0
richardwhitney avatar
How do I set the anomaly score in crs-setup.conf?
cn flag

I am using v3.0.0 of CRS with ModSecurity set to DetectionOnly mode and the nginx connector. I want to set the anomaly score to 100 or so to fine-tune the settings, but I can't see where or how to do that. Looking in crs-setup.conf

nginx 1.18.0 if that helps

Score: 1
someone324443 avatar
nginx subdomain wrong redirect
cn flag

I have set up a nginx server with this config:

server {
        server_name key.mydomain.fun;
        location / {
                proxy_pass      http://mydomain.fun:6969;
        }
}
server {
    listen 80;
    server_name admin.mydomain.fun;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name admin.mydomain.fun;
    ....
}

The strange thing is: Whe ...

Score: 0
Debugging "upstream prematurely closed FastCGI request while reading upstream"
us flag

I am running an nginx + php-fpm setup. I recently ran into problem returning binary data to the Nginx server. Nginx show this in the error log:

2021/08/04 19:22:27 [error] 996463#996463: *1 upstream prematurely closed FastCGI request while reading upstream, client: 192.168.1.10, server: foobar.com, request: "GET /somemedia.mp4 HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "foo ...
Score: 1
Parzival avatar
What happens to new connections during nginx reload
us flag

When nginx reloads, The master process first checks the syntax validity, then tries to apply new configuration. If this succeeds, it starts new worker processes, and sends messages to old worker processes requesting them to shut down gracefully.

When does the master process send shutdown message to old worker processes - is it in parallel to creating new worker processes or only after new worker  ...

Score: 0
thran avatar
Nginx puts browser into a redirect loop when using multiple server blocks
cn flag

I'm using Nginx to host a number of virtual hosts (or server blocks in Nginx nomenclature). These hosts all share the same domain with each assigned its own subdomain. One subdomain enters an endless redirect loop, obviously undesirable behavior.

NB: I've redacted my domain name and replaced it with <mysite>.

The root domain - www.<mysite>.com receives requests as expected. It also red ...

Score: 0
MBiabanpour avatar
Apache Guacamole working fine over HTTP, but not over HTTPS
us flag

I've recently installed Apache Guacamole on Ubuntu 20.04 LTS and use NGINX as the proxy server. Everything works fine with it over HTTP but when I use HTTPS, the application still loads, but then the connections are super slow (get stuck for some seconds). About configuration, I've exactly done what the official documentation says and all the services run on the same server.

EDIT: NGINX Configuration: ...

Score: 0
how to allow proxy pass with same location, with multiple context path
cn flag
server {
    listen 80;
    server_name example.com www.example.com; 
    

location /consol {

    if ($request_method !~ ^(GET|POST)$) {
        return 405 "Not allowed";
    }
     
    set $consolalb alb.backend;
    proxy_pass http://$consolalb/workspace/;
    
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host  ...
Score: 0
Ian Straton avatar
Nginx Reverse proxy can only find one site out of 3
lr flag

Update the behaviour of only being able to load one site at a time appears to be client side browser related - If I open all 3 sites in one browser window (one tab each) then we get the behaviour described below. If I use 3 separate browsers (I used Edge, Opera and Chrome) then all 3 sites load as expected. /Update

I have an Nginx reverse proxy setup to pass external traffic to one of 3 internal server ...

Score: 0
Neil Simpson avatar
Append URL parameter to request URI using Nginx
ng flag

I'm trying to append URL parameters to specific request URI's within the server block.

This is what I have so far:

if ( $request_uri = "/testing/signup" ) {
    rewrite ^ https://www.example.com/testing/signup?org=7689879&type_id=65454 last;
}

location /testing/ {
    try_files $uri $uri/ /testing/index.php;
}

However, this only works when the original request URI does not have any of it's own URL p ...

Score: 1
Docker w/ PHP-FPM & Nginx - 502 Bad Gateway
de flag

I'm currently trying to dockerise a Laravel application, I've managed to create my Dockerfile and docker-compose.yml with the dependencies I need. However, I am struggling to get php-fpm to kick in that will show my application.

Dockerfile

# Set master image
FROM php:8.0-fpm-alpine

# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/html/

# Set working directory
WORKDIR /va ...
Score: 0
Typewar avatar
Setting up SSL for custom port in nginx - letsencrypt
in flag

I'm trying to enable SSL on a custom port (not 443), running a webpage. From searching around, I couldn't find much info that helped.

The server has unchangable ports, external: 26143, Internal: 80.

To enter the server (without SSL) you would type example.com:26143, and the system would see this as a connection to port 80.

How would I set up a certificate (lets encrypt) to enable SSL on this port?


Score: 0
If you're seeing this Grafana has failed to load its application files
ae flag

I want to run grafana behind nginx. I followed this instruction. The only problem I have right now is whenever I try to edit a panel, I will see this error message below. It disappears in a few seconds. The grafana.ini looks like

domain=localhost
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true

The scrubbed nginx.conf looks like

server_name 1.2.3.4 # my public id a ...
Score: 0
Rebooted Ubuntu server, nginx site no longer accessible from browser
pk flag

I rebooted my Ubuntu server this morning because I was having what appeared to be a low-memory error (happens occasionally, hasn't been enough of a problem to try and fix it). But now, my site (which was previously working fine) is no longer accessible from the browser.

The setup: I'm running a NuxtJS site using pm2 to daemonize it, and nginx as a reverse proxy. I have a post-receive git hook so  ...

Score: 0
Why nginx "return 301" and ”try_files“ fall into an infinite loop
dk flag

my conf code:

index index.html index.php;
location / {
    if ($uri = '/a/') {
        return 301 https://example.com/a;
    }
    try_files $uri $uri/ =404; 
}

If url is /a/, 301 to /a, then try_files part, add / to /a end, become /a/.

Next step, I think it will try the index definition, become /a/index.html, and reach the file.

But actually, It tried /a/, and jump out the location, then goes int ...

Score: 0
Somjit Nag avatar
Basic HelloWorld Nginx proxy_pass giving 502 bad gateway : WSL Ubuntu
uz flag

I am simply trying to learn nginx load-balancing, and have a very basic nodejs hello world server, 4 instances of which are running in port 3001-3004.

I want to load-balance across them, but proxy_pass will not work. Can someone please help ?

Below is my nginx.conf file. Nginx is running in WSL ubuntu

events {

}

http {

  upstream allbackend {
    server 127.0.0.1:3001;
    server 127.0.0.1:3002;
    s ...
Score: 0
Mirroring Traffic with Nginx(to increase avaliablity and decrease latency )
in flag

I need to duplicate/mirror the traffic comming to my server.

I mean, I have N backend servers A1 A2 ... An(n>=2) and a nginx as reverse-proxy&load-balancer.

All the traffic comming to Nginx redirect to both Ax and Ay(x!=y) in parallel, if one of the server is down(timeout or 5xx), then the other server's response can be used immediately and return the result to the client.

By mirroring the traffic( ...

Score: 1
woon minika avatar
Why Nginx Mail Module encoded '%' to %25 in Auth-Pass header?
ph flag

I do the test with the special character password below

~`!@#$%^&*()-_+={}[]|\/:;"'<>,.?

And I realised nginx mail module encoded the % to %25, but the rest of the special character are fine, is it pre encoded from mail client level ?

 *3653 http header: "Auth-Pass: ~`!@#$%25^&*()-_+={}[]|\/:;<>,.?" 
 *3653 http proxy header: "Auth-Pass: ~`!@#$%25^&*()-_+={}[]|\/:;<>,.?" ...
Score: 1
aimee avatar
MySQL / Web Server Bottleneck
jp flag

I’m trying to determine a MySQL / Web server bottleneck.

I have three servers. A Web server running Nginx, a remote MySQL server with my Wordpress DB and another remote MySQL server storing our data.

The bottleneck I’m trying to find is between my second MySQL server storing our data and my Web server. We have a page that has three DataTables on it (three separate queries). It’s loading very s ...

Score: 0
Nginx run as apache user: how to fix owner of tmp folder
us flag

I used to set up Nginx as frontend and Apache as backend, and for the sake of simplicity used to set Nginx to run as apache user (by specifing user apache; in nginx.conf).

After that, default Nginx's tmp dir (e.g. /var/lib/nginx/tmp) become unusable by nginx as it belongs to nginx not apache. Ok, I do chown -R apache ... and fix it - but after a while (looks like until next Nginx update) the ownder of the ...

Score: 1
Syed Osama Maruf avatar
Nginx rewrite and return interfere with different location block
cn flag

I have the following configuration in nginx for redirecting in a certain scenario.

location /prefix-someurl {
   if (condition) {
            return 301 $scheme://$host/xyz.html;
   }
   proxy_pass someValue;
}

and in another block there are some rewrite rules like this

location /someurl {
   if (condition) {
            rewrite ^(.*)abc(.*)$ $1test/abc$2 break;               
            rewrite ...
Score: 0
rajesh_chaurasiya avatar
how to set up websocket server along with two laravel backend and a spa
fr flag

i have two laravel backend setup on different routes. and there is a spa on root. now i want to set a websocket server along with it. here is my website.conf


############## block-4 : multiple subdirectory testing ############
server {
    listen 80;
    #    server_name abc.xyz;
    server_name _;
    root /var/www/html/abc.xyz;
    #    root /var/www/html;

    add_header X-Frame-Options "SAMEORI ...
Score: 0
trwnh avatar
Local network domain resolution times out with DNSMasq, but works fine remotely
pe flag

For some reason, I can't get this to reliably work the way I want it, across both Linux and Windows, and even across different machines running the same OS.

Let's assume I have a local machine running on 192.168.1.66 and my public IP of 107.214.228.39 is simply forwarding all ports to that local machine via the router.

Ideally, I'd like to be able to simply resolve a FQDN regardless of whether I am loca ...

Score: 0
Mlok avatar
Rails app reload is too slow on production using Puma and Nginx
cn flag

I have a little bit bigger project on Rails (6.0.1), running on latest Puma, using socket with latest Nginx and Debian system.

App works great, but when I perform reload :

rbenv exec bundle exec pumactl -F ... restart

It takes a huuuuge time with loading page for users. It is around 2 minutes. But when I try it on test environment it restarts in 15 seconds.

So I think it should be something with worker ...

Score: 1
DevOpsSauce avatar
Redirect secure domain to another via CNAME and an Nginx Docker Container
jp flag

Update: I have appended a 2nd attempt at the bottom of this post. It is "working," but I would like to make my original idea work.

I am attempting to redirect an https request for a domain to another via a redirect server.

I will use https://website.com, https://website2.com, and https://myredirectserver.com for examples.

I have an SSL cert purchased for website.com, and it's DNS is CNAMED at www

Score: 0
Julien avatar
Nginx redirect path to different path
cn flag

I'm trying to redirect urls with Ninx but i'm struggling to get it right:

example.com/{dynamic1}/foo/bar/{dynamic2} to example.com/{dynamic1}/bar/{dynamic2}

basically i'm trying to remove the /foo/ portion of the url.

i've tried the following:

location ~* ^/(.*)/foo/bar/(.*)$ {
  return 302 ^/$1/bar/$2?$args;
} 

and also:

location ~ ^/([^/]*)/foo/bar/(.*)$ {
  return 302 ^/$1/bar/$2?$args;
}

but thi ...

Score: 0
Chris Ostmo avatar
Large tmp file transfer hangs in nginx php-fpm proxy
cn flag

We have a server that's running a WordPress site with a serverpilot-installed nginx stack on Ubuntu 20 LTS.

Very large uploads appear to get stuck in the handoff between the nginx proxy and PHP, and I have come to the end of what I know how to troubleshoot without just poking at it to see what happens (which is rarely a good use of time or way to move forward). So far as I can tell, I have increa ...

Score: 0
ksav avatar
Docker wordpress/ nginx-proxy / nginx-proxy-companion - lets encrypt auto renewal - update image and restart?
cn flag

I have a wordpress site on an aws ec2 that was setup (by someone else) to auto renew its SSL certificate via Let's Encrypt.

The auto renewal has recently stopped and the certificate has since expired.

I have attempting to run docker exec {container_id} /app/force_renew but received this error:

ACME server returned an error: urn:acme:error:serverInternal :: The server experienced an internal error ...

Score: 1
woon minika avatar
nginx mail module always passing PLAIN method AUTH command to backend
ph flag

I have implemented a nginx with mail module, and proxy to backend Hmail server. I realized no matter how I disable the auth-methods PLAIN. The nginx is just ignoring it.

How can I force to using smtp_auth login instead? As Hmail server does not support AUTH_PLAIN mechanism.


auth_http  localhost:8080/auth.pl;

 server {
        # not working as always AUTH_PLAIN
        listen    25;
        protocol  ...
Score: 0
kevin avatar
nginx reverse-proxy 502 (111: connection refused) while connecting to upstream
cn flag

I have the following nginx configuration:

server {

    listen: 8080;
 
    location / {
        proxy_pass           https://somehost.abc.xyz;
        proxy_redirect       off;
        proxy_set_header     Host somehost.abc.xyz;
        proxy_set_header     food pizza;
    }

}

When i hit the proxy i get the following error:

connect() failed (111: Connection refused) while connecting to upstream, cli ...