Skip to content

Instantly share code, notes, and snippets.

@phretor
Created December 21, 2010 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phretor/750821 to your computer and use it in GitHub Desktop.
Save phretor/750821 to your computer and use it in GitHub Desktop.
#nginx.conf
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
server_tokens off;
include /usr/local/nginx/conf/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
error_log /usr/local/nginx/logs/error.log crit;
access_log /usr/local/nginx/logs/access.log;
keepalive_timeout 0;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/x-javascript application/xml application/atom+xml text/javascript;
#sites
include /usr/local/nginx/conf/sites/seclab/conf;
}
#seclab/conf
server {
server_name seclab;
listen 80;
listen 443 default ssl;
ssl_certificate /usr/local/nginx/conf/sites/seclab/certs/server.crt;
ssl_certificate_key /usr/local/nginx/conf/sites/seclab/certs/server.key;
access_log /usr/local/nginx/logs/seclab.access;
error_log /usr/local/nginx/logs/seclab.error info;
expires -1;
add_header Cache-Control private;
default_type text/html;
error_page 502 503 504 @maintenance;
location @maintenance {
default_type text/plain;
root /home/seclab/webroot;
rewrite ^(.*)$ /maintenance.html break;
}
location /admin/ {
if ( $scheme == "http" ) {
rewrite ^ https://$host$uri;
}
}
location /media/ {
alias /home/seclab/media/;
}
location /stats/ {
expires max;
add_header Cache-Control private;
alias /var/www/webalizer/seclab/;
auth_basic "Restricted area";
auth_basic_user_file /usr/local/nginx/conf/seclab/htpasswd;
}
location / {
uwsgi_pass unix://var/run/uwsgi/seclab.sock;
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment