New answers tagged

0 votes

Use hostname for set_real_ip_from in Nginx

Since 1.13.1, trusted addresses may also be specified using a hostname.
Mitar's user avatar
  • 517
0 votes
Accepted

Nginx add_header only works when content type specified

Eventually, I managed to piece this together. set $special_headers false; set $special_link ''; location ~* "/Record\.([A-Za-z0-9]{4,6})$" { set $special_headers true; set $special_link ...
knirirr's user avatar
  • 119
0 votes

Use hostname for set_real_ip_from in Nginx

As per Nginx's documentation, no. You can use an IP, CIDR, or unix socket : Syntax: set_real_ip_from address | CIDR | unix:;
t00r's user avatar
  • 1
0 votes

Nginx conf duplicate issues

Let's Encrypt will manage these properties directly. Certbot will add the following line to your nginx.conf file: include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot For Certbot to ...
ergohack's user avatar
  • 101
0 votes

Nginx try_files succeeds on deleted files, then nginx reports error with open()

This is just a wild guess, but when file is deleted on Linux opened handle remains valid. Is it possible, that NGINX process still sees the old, deleted file as valid but no other process may open it? ...
neznanec's user avatar
1 vote

Nginx as forward proxy for secure LDAP

For nginx you must configure a stream block which terminates the SSL/TLS connection from the client -- using a cert trusted by the client for the hostname the client uses, see below -- and originates ...
dave_thompson_085's user avatar
2 votes

nginx in front of Rails

Why do you think that the configuration of your origin server has anything to do with the protocols of the reverse proxy in front of it? Just configure mypage.com and secure.mypage.com as different ...
symcbean's user avatar
  • 21.7k
1 vote
Accepted

How does NGINX Plus handle server failure when doing session persistence for TCP/UDP communication?

It feels like the two might become mutually exclusive Yes. That's not a problem specific to nginx. By far the best solution is to have your session data replicated / highly available - but that's not ...
symcbean's user avatar
  • 21.7k
-1 votes

nginx, serve php files

It appears to be a browser issue particularly Chrome. Chrome doesn't like serving documents over HTTP it's cries HTTPS only and downloads rather than serving docs. Even following a browser cache ...
cookie's user avatar
  • 63
0 votes

Filtering the $query_string in Nginx

Good afternoon, everyone. In any case, you will need filtering not only fields, but also filtering forms, URL links, etc. I have not been looking for a similar solution for a long time, but for other ...
Крипто Бот's user avatar
0 votes

uwsgi queue of socket message flood?

recomiendo aumentar el net.core.somaxconn a 200 con: sysctl -w net.core.somaxconn=200 o hacerlo permanente desde su /etc/sysctl.conf file conf
Miguel Guzmán 's user avatar
1 vote

Serve multiple apps with nginx proxy_pass

I think I figured out what you are trying to solve. When you request a page from /app2/ it tries to load additional resources like /main.js, which results in a 404 error because it should be /app2/...
Gerald Schneider's user avatar
1 vote
Accepted

Target app assets not loaded with nginx proxy_pass

After further digging and testing, the rewrite solution detailed in https://stackoverflow.com/questions/62836801/nginx-reverse-proxy-how-to-serve-multiple-apps worked in my case. This is the snippet I ...
Asmaa's user avatar
  • 31
0 votes

I am getting 413 requested entity is too large error while uploading audio files to flask website

Try to add this line at your site conf. server { ... client_max_body_size 0; ... } You can change the value to 200M, for example. After that, restart your nginx.
Mateus Roveda's user avatar
2 votes
Accepted

Extract XML Request body variable into an nginx variable

In the map method, I will replace $s by $1 so it will assigned the extracted value to the student_id. Therefore you can use the student_id variable in your if statement. That's how I was able to ...
Bahel Gladys's user avatar
0 votes

nginx and php-fpm waiting for server too long

Yes, there's stuff wrong with your config, but your primary issue is arising within the PHP execution (or any persistence layer such as a DB underneath the PHP). Check for session contention, ...
symcbean's user avatar
  • 21.7k
0 votes

nginx and php-fpm waiting for server too long

You should install xhprof, this way you'll see where the time is spent. Using PECL (https://pecl.php.net/package/xhprof) pecl install xhprof And use the xhprof_html and xhprof_lib from this project ...
Yvan's user avatar
  • 414
0 votes

nginx systemd[1]: nginx.service: Failed with result 'exit-code'

Maybe you can remove nginx first and reinstall it. List packages installed related to nginx, and remove them. dpkg --get-selections | grep nginx sudo apt --purge remove nginx sudo apt --purge remove ...
Eason Lin's user avatar
0 votes

Nginx upstream reponse time occasionally very slow

So after turning on debug output in Nginx it seems the problem was with the Nchan module in the nginx-extras package from Phusion Passenger, that one is buggy and would hang once in a while, once i ...
Julien's user avatar
  • 242
0 votes

How redirect ANY site not found in Hestia to another server - Nginx proxy manager

This should be a comment, but it's a bit long. I don't know what you are asking here. If you are terminating the SSL on the nginx server, then either you have an absolute monster of an SSL certificate,...
symcbean's user avatar
  • 21.7k
0 votes

nginx autoindex: include dot (hidden) files in directory listing

it is now possible to use fancyindex module to show dot/hidden files
razdva12's user avatar
0 votes

How to switch PHP versions in Nginx if fastcgi_pass is pointing to a TCP socket

Perhaps my question wasn't clear, I'm not a sysadmin, so it's not all as clear to me as it probably should. However, reading @symcbean's answer made it clear to me that switching to a UNIX socket ...
Daan van den Bergh's user avatar
0 votes

How to switch PHP versions in Nginx if fastcgi_pass is pointing to a TCP socket

Your question is a bit confused - there are at least 3 configurations (8.2 with network socket, 8.1 with network socket, 8.1 with network socket) only the nginx conf for one of the configurations and ...
symcbean's user avatar
  • 21.7k
-1 votes

Serve multiple apps with nginx proxy_pass

What I do is Create a "sites-enabled" and "sites-available" Folder, inside of the "/etc/nginx" Folder. Then, I Add the following Line to my nginx.conf file. Include /etc/...
Matti's user avatar
  • 21
0 votes

Multiple subdomains to log into phpMyAdmin with Nginx

That's not HTTP redirection, but the Nginx can serve the same web application from multiple host names or paths. The server_name has Syntax: server_name name ...; in your case: server_name pma....
Esa Jokinen's user avatar
  • 47.4k
0 votes

How do I remove a server-added header from proxied location?

I had the exact same issue. We have global CSP rules at the nginx.conf (http) level which then needed to be removed at the server level / virtualhost level to let the proxied CSP header - generated by ...
Thomas's user avatar
  • 101
0 votes
Accepted

502 Bad Gateway nginx 1.20.1

From the commands you provided above, you did not install php-fpm. You need to run yum install --enablerepo=remi-php80 php-fpm
symcbean's user avatar
  • 21.7k
0 votes
Accepted

NGINX: Redirect to Non-www address

(this is mostly comment, but space is limited) I want all http traffic to redirect to https, OK, seems sensible. and connections to my website's www subdomain and to my server ip address (123.123....
symcbean's user avatar
  • 21.7k
0 votes
Accepted

What steps can I take to troubleshoot why my server is not accessible over HTTPS after enabling SSL with Certbot?

Since you just basically posted only minor information, based on that, the Configuration might work: # Default server configuration # which means its a catch all for these that are not configured, if ...
djdomi's user avatar
  • 1,624
0 votes

How can I configure Nginx to redirect all traffic to my website to the HTTPS WWW version and HTTPS version for subs with a consistent URL structure

The problem was actually from cloudflare. I managed to fix by clearing cloudflare cache. also the client_max_body_size 8M; was to small changed it to 16M.
Crypto Coupons's user avatar
0 votes
Accepted

How to serve php files from a folder outside of web root folder in nginx

Your values for root and SCRIPT_FILENAME under the location ^~ /php block are incorrect. The URI currently being processed includes the prefix /php/ and is combined with the root value to form the ...
Richard Smith's user avatar
1 vote

Preview website without DNS like hostcx

Creating a website like HostCX using Nginx Reverse Proxy is certainly possible. Nginx can be a powerful tool for routing incoming requests to different backend servers based on various criteria, ...
PACKET TEL INC's user avatar
0 votes

Nginx having multiple sites-enabled breaks nginx

@symcbean actually pointed out the answer. The configs I posted were incomplete. For app1 I used the exact config shown (which worked somehow) and then ran certbot which added the TLS config and ...
DevShadow's user avatar
  • 101
1 vote

Nginx. Override header in cached object, is it possible?

Seems like you're looking for proxy_hide_header directive.
drookie's user avatar
  • 8,700
0 votes

nginx download the latest file based on filename pattern

That's not possible with vanilla nginx since it cannot do math within it's basic config syntax. However, it's possible with Lua code in it's config, - you can implement any logic you want; minimal ...
drookie's user avatar
  • 8,700
0 votes

Nginx check if parameters exists and if so only allow specific values

I guess that you need something like this (using map): map $arg_page $need_redirect { default "1"; "" "0"; "2" "0"; "14" ...
Alexey Ten's user avatar
  • 8,464
0 votes

GitLab Pages running in Docker inaccessible from outside the container

My latest config for gitlab 16.x.x GITLAB_OMNIBUS_CONFIG: | ### Web interace settings external_url "https://gitlab.domain.org" nginx['listen_port'] = 80 nginx[...
Roman Dolgov's user avatar
0 votes

Trying to run Security Onion on AWS behind an ALB (nginx behind ALB)

I was able to get this working by inserting a simple healthcheck in the nginx config. server { listen 443 ssl http2; server_name 192.168.1.something; location ...
jorfus's user avatar
  • 755
1 vote

nginx proxy_pass using subfolder

The answer of Tero Kilkanen is great. However, in some situations, the non-named regex group(ex: $1) cannot be found. We can use the named group(ex: $sub_dir) to prevent this error. location ~/app2(?&...
peterhpchen's user avatar
0 votes

nginx: [warn] protocol options redefined

I experienced the same issue because the default_server block did not include the ssl directive. So it should have been: server { listen 443 default_server ssl; listen [::]:443 default_server ssl; ...
smac89's user avatar
  • 138
0 votes

Get file exif data in NGINX

File modification time is NOT the same as the photo creation date. While it would be simple to force the mtime to match the EXIF data and use that as a proxy for the data you actually want to report, ...
symcbean's user avatar
  • 21.7k
0 votes

Showing images using a template .html file in NGINX

here is my full config. I've changed it a bit since and it works now: map $request_uri $request_basename { ~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename; } server {...
StuckDuck's user avatar
0 votes
Accepted

Unable to verify TLS cert with only CommonName in NGINX reverse proxy

I ended up getting this mostly working. I traced the NGINX error to X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE. Turns out, the certificate wasn't actually self signed. It was signed by a private CA, ...
TimeMalt's user avatar
  • 101
0 votes

Running PHP7.4 FPM on Ubuntu. Forgot to install PHP7.2-curl. Wondering if I will need to bring down all the other websites for the change

When restarting php-fpm, it is all or nothing. Unfortunately there is no way to restart an individual site pool.
Matt Morrow's user avatar

Top 50 recent answers are included