Nginx (pronounced "engine-ex") can be used as an open source reverse proxy server, as well as a load balancer, HTTP cache, and not to forget a fast and powerful web server.
- Ubuntu server
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| # | |
| # Auth filter /etc/fail2ban/filter.d/nginx-auth.conf: | |
| # | |
| # Blocks IPs that makes too much accesses to the server | |
| # | |
| [Definition] | |
| failregex = ^<HOST> -.*"(GET|POST).*HTTP.*" | |
| ignoreregex = |
| proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:120m inactive=180m max_size=50m; | |
| proxy_cache_path /var/lib/nginx/cache/php levels=2:2 keys_zone=php:10m inactive=180m max_size=50m; | |
| proxy_temp_path /var/lib/nginx/proxy; | |
| proxy_connect_timeout 30; | |
| proxy_read_timeout 120; | |
| proxy_send_timeout 120; | |
| #IMPORTANT - this sets the basic cache key that's used in the static file cache. | |
| proxy_cache_key "$scheme://$host$request_uri"; | |
| # http://wp-performance.com/2010/10/nginx-reverse-proxy-cache-wordpress-apache/ |
| ====== | |
| Videos | |
| ====== | |
| DevOps | |
| What is DevOps? by Rackspace - Really great introduction to DevOps | |
| https://www.youtube.com/watch?v=_I94-tJlovg | |
| Sanjeev Sharma series on DevOps (great repetition to really get the DevOps concept) |
| <?php | |
| class Mysql{ | |
| static private $link = null; | |
| static private $info = array( | |
| 'last_query' => null, | |
| 'num_rows' => null, | |
| 'insert_id' => null | |
| ); |
| resource "digitalocean_droplet" "haproxy-www" { | |
| image = "ubuntu-14-04-x64" | |
| name = "haproxy-www" | |
| region = "nyc2" | |
| size = "512mb" | |
| private_networking = true | |
| ssh_keys = [ | |
| "${var.ssh_fingerprint}" | |
| ] | |
| connection { |
| # Set the variable value in *.tfvars file | |
| # or using -var="do_token=..." CLI option | |
| variable "do_token" {} | |
| variable "ssh_key_name" {} | |
| # Configure the DigitalOcean Provider | |
| provider "digitalocean" { | |
| token = "${var.do_token}" | |
| } |