Jump to content

Slow NGINX Reverse Proxy

Go to solution Solved by colonel_mortis,

A couple of things that I noticed in your config file are that proxy_cache_bypass $http_upgrade seems weird (but you don't seem to have proxy caching enabled in the first place so that shouldn't matter), and that your upstream seems to be on the same host as your nginx but you're using the public IP rather than localhost. If you change the proxy_pass IP to 127.0.0.1 instead, does that make any difference?

 

As a sanity check, what's the performance of skipping nginx and hitting the backend directly (either from your local machine or SSHed into that box), and of serving a static file directly from nginx (a 404 page works)? If there's a problem with the proxying specifically, the proxy request would be quite a bit longer than the sum of those two.

Hey, 

 

So I'm running NGINX on my VPS and I am experiencing really slow website loading times when loading a reverse proxy. I have tried running it with one virtual host and still experiencing bad load times.

 

The two main reverse proxies I'm experiencing it with are docker.benwhybrow.com (portainter) and mail.benwhybrow.com (roundcube).

 

This is my virtual host file for portainer: https://hasteb.in/jabinule.nginx

My virtual host file for roundcube: https://hasteb.in/xuvoruza.nginx

My nginx.conf file: https://hasteb.in/ihosecuv.shell

 

Any help would be much appreciated! 

PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to comment
https://linustechtips.com/topic/1218627-slow-nginx-reverse-proxy/
Share on other sites

Link to post
Share on other sites

A couple of things that I noticed in your config file are that proxy_cache_bypass $http_upgrade seems weird (but you don't seem to have proxy caching enabled in the first place so that shouldn't matter), and that your upstream seems to be on the same host as your nginx but you're using the public IP rather than localhost. If you change the proxy_pass IP to 127.0.0.1 instead, does that make any difference?

 

As a sanity check, what's the performance of skipping nginx and hitting the backend directly (either from your local machine or SSHed into that box), and of serving a static file directly from nginx (a 404 page works)? If there's a problem with the proxying specifically, the proxy request would be quite a bit longer than the sum of those two.

HTTP/2 203

Link to post
Share on other sites

On 7/6/2020 at 1:53 PM, colonel_mortis said:

A couple of things that I noticed in your config file are that proxy_cache_bypass $http_upgrade seems weird (but you don't seem to have proxy caching enabled in the first place so that shouldn't matter), and that your upstream seems to be on the same host as your nginx but you're using the public IP rather than localhost. If you change the proxy_pass IP to 127.0.0.1 instead, does that make any difference?

 

As a sanity check, what's the performance of skipping nginx and hitting the backend directly (either from your local machine or SSHed into that box), and of serving a static file directly from nginx (a 404 page works)? If there's a problem with the proxying specifically, the proxy request would be quite a bit longer than the sum of those two.

Thank you! Changing it to 127.0.0.1 fixed the issue. I also removed the proxy_cache_bypass from the virtual host. It loads perfectly fine. Appreciate the help! Have a good day! 

PC: 

Spoiler

Motherboard: MSI Z390-A PRO

CPU: Intel Core i7-9700K @ 3.60GHz

Memory: 32GB (4x8GB) Corsair Vengeance 

Graphics Card: NVIDIA GeForce RTX 3060 Ti

Boot: Crucial P3 2TB M.2

SSD: Crucial BX500 1TB SSD

SSD: Crucial P2 500GB M.2

PSU: Gigabyte P750GM 750W

Case: IONZ KZ10

"Server": 

Spoiler

Motherboard: X99 RSA mATX (eBay special)

CPU: Intel Xeon E5-2680 v4 @ 2.4GHz

Memory: 64GB (2x32GB) Dataram ECC DDR4

Graphics Card: NVIDIA Quadro P2000

Boot: Kingston NV3 1TB M.2

PSU: Corsair CX550

Case: Fractal Design Core 1000

OS: Proxmox Virtual Environment

Other Gear:

Spoiler

Phone: Google Pixel 6 (128GB)

Watch: Google Pixel Watch

 

Headphones: SteelSeries Arctis 3

Microphone: Blue Snowball Ice

Speakers: Creative T100

 

Car: 2010 Mazda 3 Takuya - 1.6L Petrol 103bhp

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×