-
-
Save ggamel/5006375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error_log info; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main | |
'$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $bytes_sent ' | |
'"$http_referer" "$http_user_agent" ' | |
'"$gzip_ratio"'; | |
client_header_timeout 10m; | |
client_body_timeout 10m; | |
send_timeout 10m; | |
connection_pool_size 256; | |
client_header_buffer_size 1k; | |
large_client_header_buffers 4 2k; | |
request_pool_size 4k; | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 5; | |
gzip_min_length 512; | |
gzip_buffers 4 8k; | |
gzip_proxied any; | |
gzip_types | |
# text/html is always compressed by HttpGzipModule | |
text/css | |
text/javascript | |
text/xml | |
text/plain | |
text/x-component | |
application/javascript | |
application/x-javascript | |
application/json | |
application/xml | |
application/rss+xml | |
font/truetype | |
font/opentype | |
application/vnd.ms-fontobject | |
image/svg+xml; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_vary on; | |
output_buffers 1 32k; | |
postpone_output 1460; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 75 20; | |
ignore_invalid_headers on; | |
index index.html; | |
perl_modules /etc/nginx/perl_lib/; | |
perl_require SecureLink.pm; | |
server { | |
listen 0.0.0.0 default_server; | |
server_name flatus.fremnet.net; | |
server_name_in_redirect off; | |
gzip_static on; | |
access_log /var/log/nginx/flatus.fremnet.net.access_log main; | |
error_log /var/log/nginx/flatus.fremnet.net.error_log info; | |
root /var/www/flatus.fremnet.net/htdocs; | |
ancient_browser_value "ancient."; | |
ancient_browser links lynx netscape4; | |
ancient_browser "msie 4.0" "msie 5.0" "msie 5.5" "msie 6.0" "msie 7.0" "msie 8.0"; | |
modern_browser_value ""; | |
modern_browser unlisted; | |
index index.${ancient_browser}html index.html; | |
location ~ ^/download/(?<secure>[\w\-=]+,\d+)(?<file>/.*)$ { | |
secure_link $secure; | |
secure_link_md5 $secure_link_expires.$file.SECRET; | |
if ($secure_link = "") { | |
return 403; | |
} | |
if ($secure_link = 0) { | |
return 410; | |
} | |
alias /var/www/$host/downloads$file; | |
} | |
} | |
server { | |
server_name bukkit.fremnet.net www.bukkit.fremnet.net; | |
access_log /var/log/nginx/bukkit.fremnet.net.access_log main; | |
error_log /var/log/nginx/bukkit.fremnet.net.error_log info; | |
root /var/www/bukkit.fremnet.net/htdocs; | |
charset utf-8; | |
add_header "X-UA-Compatible" "IE=Edge,chrome=1"; | |
# Favicon | |
location ~* \.ico$ { | |
expires 1w; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
# Media: images, video, audio, HTC, WebFonts | |
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ { | |
expires 1M; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
# CSS and Javascript | |
location ~* \.(?:css|js)$ { | |
# expires 1y; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
error_page 404 /404.html; | |
location ~ ^/\d\d\d\.html$ { | |
gzip_static on; | |
} | |
location ~ ^/p/(?<pjax>.*)$ { | |
ssi on; | |
alias /var/www/$host/htdocs/$pjax; | |
} | |
location / { | |
ssi on; | |
if ($http_X-PJAX ~ true) { | |
rewrite ^(.*)$ /p$1 last; | |
} | |
if ($arg__pjax ~ true) { | |
rewrite ^(.*)$ /p$1 last; | |
} | |
add_before_body /templates/header.html; | |
add_after_body /templates/footer.html; | |
} | |
location ~ ^/download/(?<secure>[\w\-=]+,\d+)(?<file>/.*)$ { | |
secure_link $secure; | |
secure_link_md5 $secure_link_expires.$file.SECRET; | |
if ($secure_link = "") { | |
return 403; | |
} | |
if ($secure_link = 0) { | |
return 410; | |
} | |
alias /var/www/$host/downloads$file; | |
} | |
} | |
# SSL example | |
#server { | |
# listen 127.0.0.1:443; | |
# server_name localhost; | |
# ssl on; | |
# ssl_certificate /etc/ssl/nginx/nginx.pem; | |
# ssl_certificate_key /etc/ssl/nginx/nginx.key; | |
# access_log /var/log/nginx/localhost.ssl_access_log main; | |
# error_log /var/log/nginx/localhost.ssl_error_log info; | |
# root /var/www/localhost/htdocs; | |
#} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment