daemon off; worker_processes 1; events { worker_connections 1024; } http { include mime.types; sendfile on; gzip on; gzip_vary on; # Some things are gzipped on the fly, but tweets.txt.gz is kept gzipped on disk to save disk space gzip_types application/x-javascript text/css application/javascript application/json; server { listen 80; server_name greptweet.com; root /srv/http; charset utf-8; access_log /var/log/nginx/greptweet.access.log; error_log /var/log/nginx/greptweet.error.log; error_page 403 =303 /404.php; error_page 404 /404.php; location / { index index.php index.html; rewrite ^/f/(.*)$ /create.php?id=$1 last; } location ~ \.(gz)$ { add_header Content-Encoding gzip; gzip off; } location ~ \.(txt)$ { rewrite ^/u/(.*)/ /u/$1/$1.txt.gz last; } location ~* \.(svg|css|js)$ { expires 7d; } location ~* \.(appcache)$ { expires 30s; } location ~ \.php$ { try_files $uri = 404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } }