-
-
Save aziz/377985 to your computer and use it in GitHub Desktop.
nginx.conf
This file contains hidden or 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
# --prefix=/usr --add-module=/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access_log --error-log-path=/var/log/nginx/error_log --with-http_ssl_module --with-http_geoip_module --with-http_realip_module --with-http_addition_module --with-http_stub_status_module --with-http_flv_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --add-module=/home/aziz/nginx-modules/http_push_module --add-module=/home/aziz/nginx-modules/upload_progress_module --add-module=/home/aziz/nginx-modules/zip_module --add-module=/home/aziz/nginx-modules/memc_module --add-module=/home/aziz/nginx-modules/mp4_stream_module | |
# --with-http_ssl_module | |
# --with-http_geoip_module | |
# --with-http_realip_module | |
# --with-http_addition_module | |
# --with-http_stub_status_module | |
# --with-http_flv_module | |
# --add-module=/http_push_module | |
# --add-module=/upload_progress_module | |
# --add-module=/zip_module | |
# --add-module=/memc_module | |
# --add-module=/mp4_stream_module | |
# --with-http_gzip_static_module | |
# nginx_accept_language_module | |
# echo-nginx-module | |
# ngx_http_secure_download_module | |
# == nginx.conf ============================================================ | |
user www-data; | |
worker_processes 6; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 10; | |
gzip on; | |
gzip_comp_level 2; | |
gzip_proxied any; | |
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
tcp_nopush on; | |
tcp_nodelay off; | |
passenger_root /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-2.2.9; | |
passenger_ruby /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby; | |
include /etc/nginx/sites-enabled/*; | |
} | |
# === sites-available/dochar ================================================== | |
server { | |
listen 80; | |
server_name www.doostak.com; | |
rewrite ^/(.*) http://doostak.com/$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name doostak.com; | |
access_log /home/www/doostak.com/shared/log/access.log; | |
error_log /home/www/doostak.com/shared/log/error.log; | |
root /home/www/doostak.com/current/public; | |
passenger_enabled on; | |
# Set the max size for file uploads | |
client_max_body_size 100M; | |
# adding e-tag to static contents | |
location ~* \.(ico|css|js|gif|jp?g|png|swf|xml|html)(\?[0-9]+)?$ { | |
expires max; | |
break; | |
} | |
# this rewrites all the requests to the maintenance.html | |
# page if it exists in the doc root. This is for capistrano's | |
# disable web task | |
if (-f $document_root/system/maintenance.html) { | |
rewrite ^(.*)$ /system/maintenance.html last; | |
break; | |
} | |
location / { | |
# needed to forward user's IP address to rails | |
proxy_set_header X-Real-IP $remote_addr; | |
# needed for HTTPS | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect false; | |
proxy_max_temp_file_size 0; | |
# If the file exists as a static file serve it directly without | |
# running all the other rewite tests on it | |
if (-f $request_filename) { | |
break; | |
} | |
# this is the meat of the rails page caching config | |
# it adds .html to the end of the url and then checks | |
# the filesystem for that file. If it exists, then we | |
# rewite the url to have explicit .html on the end | |
# and then send it on its way to the next config rule. | |
# if there is no file on the fs then it sets all the | |
# necessary headers and proxies to our upstream mongrels | |
if (-f $request_filename.html) { | |
rewrite (.*) $1.html break; | |
} | |
} | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /var/www/apps/mysite.com/current/public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment