Browsing Tagnginx

Nginx on Windows in 5 minutes

Nginx on Windows in 5 minutes or less with Docker

Wait whaat? Nginx on Windows, who cares about that?? Actually many people do. Fortunately now is the greatest time to be a software engineer! Here is why.

I bet you heard about Docker in the past. If you didn’t then you probably living under a rock and you need to come out of there soon.  …

Continue reading  »

Nginx upstream timed out

Nginx upstream timed out (why and how to fix)

Nginx upstream timed out (110: Connection timed out) while reading response header from upstream is pretty common error. Lets find out why it happens and how to avoid it.

When you get this error, it usually means your upstream is slow and while there are couple easy fixes which I’ll show below,  …

Continue reading  »

HAProxy vs Nginx

HAProxy vs Nginx – what’s in your wallet?

“HAProxy vs Nginx, which one should I choose??” – I get asked this question almost every day and while I’m not a fan of “vs” style posts, I’ll try to express my opinion on the topic that may or may not help you to select a product for your particular use case.  …

Continue reading  »

Nginx resolver explained

Nginx resolver explained

Nginx resolver is playing very important part in creating fault tolerant setups, especially when it comes to the free open source version. In this article I’ll explain why we need Nginx resolver and how it works.

I remember the moment about a year or so ago when I came to the office and found people screaming that one of our sites was hacked.  …

Continue reading  »

Nginx Access-Control-Allow-Origin

Nginx Access-Control-Allow-Origin and CORS

Nginx Access-Control-Allow-Origin header is part of CORS standard (stands for Cross-origin resource sharing) and used to control access to resources located outside of the original domain sending the request.

This standard was created to overcome same-origin security restrictions in browsers, that prevent loading resources from different domains.  …

Continue reading  »

nginx_server_name

What is nginx server_name and how it works?

Nginx server_name is a special directive used for server block configuration selection. Let say you have multiple server sections in your Nginx config file:

server {
 listen 80;
 server_name test.com;

 ...
}

server {
 listen 80;
 server_name example.com;

 ...
}

When we get incoming request with test.com “Host”  …

Continue reading  »

Little trick to get AWS instance_id as variable in Nginx

If you are running in AWS environment it might be useful to get Amazon instance_id in Nginx for different purposes (logging, headers etc).

To do that we need to compile Nginx with Perl support (–with-http_perl_module flag during compilation). After that is done we can put this snippet inside of our httpd Nginx config section:

Important: While the Perl module is performing a long-running operation,  …

Continue reading  »