Skip to content

Instantly share code, notes, and snippets.

View caquino's full-sized avatar

Cassiano Aquino caquino

View GitHub Profile
iptables -t mangle -A PREROUTING -d VIP.IP.ADDRESS/32 -p tcp -m tcp --dport 80 -j MARK --set-mark 80
iptables -t mangle -A PREROUTING -d VIP.IP.ADDRESS/32 -p tcp -m tcp --dport 443 -j MARK --set-mark 80
virtual_server VIP.IP.ADDRESS 0 {
delay_loop 5
lb_kind NAT
lb_algo lc
persistence_timeout 600
protocol TCP
real_server SERVER.01.IP 0 {
weight 1
HTTP_GET {
upstream staticcontent {
keepalive 128;
server backend-01:80 max_fails=5 fail_timeout=15s;
server backend-02:80 max_fails=5 fail_timeout=15s;
server backend-03:80 max_fails=5 fail_timeout=15s;
server backend-04:80 max_fails=5 fail_timeout=15s;
}
upstream dynamiccontent {
keepalive 128;
RewriteEngine on
RewriteRule ^([^\s]*)\s(.*)$ $1-$2 [R=301,N,DPI]
Get-NetAdapter | where {$_.status -eq "UP" -and $_.interfacedescription -like "*Multiplex*"}
New-NetIPAddress -InterfaceIndex IFINDEX -IPAddress IPADDRESS -PrefixLength PREFIX -DefaultGateway GWIPADDRESS
@caquino
caquino / nginx.conf
Created November 22, 2013 02:38
PHP Persistent connections
upstream webservice-pers {
server webservices.remoteserver.com:80 max_fails=0 fail_timeout=30s;
keepalive 1024;
}
server {
listen 8080;
server_name webservices.localserver.com;
location / {
include_recipe "rsyslog"
begin
t = resources(:template => "/etc/rsyslog.conf")
t.source "rsyslog.conf.erb"
t.cookbook "example"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find template /etc/rsyslog.conf to modify"
end
@caquino
caquino / syslog-ng.conf
Created November 26, 2013 16:54
syslog nginx configuration
source s_nginx_20 { pipe("/srv/logs/access.log" program_override("nginx-access-log")); };
source s_nginx_21 { pipe("/srv/logs/error.log" program_override("nginx-error-log")); };
filter f_nginx_20 { match("nginx-access-log" value("PROGRAM")); };
filter f_nginx_21 { match("nginx-error-log" value("PROGRAM")); };
destination d_remote { tcp("central.syslog", port(514)); };
log { source(s_nginx_20); filter(f_nginx_20); destination(d_messages); };
log { source(s_nginx_21); filter(f_nginx_21); destination(d_messages); };
server {
listen 80;
server_name backend;
root /usr/share/nginx/www;
index index.html index.html;
location / {
header_filter_by_lua '