I’m an avid fan of the Sublime Text editor, and I also work with Nginx very frequently. Sadly, Sublime Text has no built-in support for Nginx configuration files, and the only existing plugin was very poor. Recently, I decided to investigate the process to make my own syntax highlighting plugin for Sublime, and it turned […]
Nginx
Disable sendfile when using Nginx + Vagrant
Source: http://jeremyfelt.com/code/2013/01/08/clear-nginx-cache-in-vagrant/ Scenario 1… You installed Vagrant with VirtualBox on your local machine and have a sweet nginx setup going as your development environment. You made a few changes to a CSS file and the new style is not reflecting on the page. You try saving the file again in your text editor, no go. You look at the file […]
Nginx SSL behind SSL terminator
Recently I ran into an issue when using Nginx behind an SSL terminator (load balancer). Both $scheme in Nginx and $_SERVER[‘HTTPS’] in PHP were incorrect, because Nginx thought it was behind HTTP. I finally figured out a fix, which is a bit hacky, but it works. In your site config, above your server block, put […]
Nginx, Varnish and optional CloudFlare: Real IPs
If you use a proxy such as Varnish or CloudFlare, your web server isn’t going to see visitor’s real IP address, it’ll see the IP of your proxy (for example, Varnish would be 127.0.0.1 if running on the same box as your web server). You can easily find instructions to fix this for Varnish or […]
Nginx + Varnish Wrong Port With Redirects
I recently switched my blog and many of my sites over to a new server stack, with Varnish running in front of Nginx + PHP-FPM. I noticed an issue however. When requesting a path like: http://brandonwamboldt.ca/assets, I was being redirected to http://brandonwamboldt.ca:8000/assets/. This alone took me a few minutes to discover, as the original problem […]