Created
January 16, 2013 04:41
-
-
Save hrysd/4544683 to your computer and use it in GitHub Desktop.
nginx
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
| # Mainモジュール | |
| # ワーカープロセスを実行するユーザーの指定 | |
| user www-data; | |
| # ワーカープロセスの数。さくらのVPSのコア数にあわせた。 | |
| worker_processes 2; | |
| # 全体でのエラーログの詳細度の指定。 | |
| error_log logs/error.log notice; | |
| # Nginxデーモンのpidのパス | |
| pid logs/nginx.pid; | |
| # ワーカープロセスの優先度の指定 | |
| worker_priority -5; | |
| # ワーカープロセスが同時に使用できるファイル数の定義 | |
| worker_rlimit_nofile 1024; | |
| # Eventsモジュール | |
| # ワーカープロセスが同時に処理できる接続数の定義 | |
| events { | |
| worker_connections 128; | |
| } | |
| http { | |
| include 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"'; | |
| access_log logs/access.log main; | |
| sendfile on; | |
| tcp_nopush on; # off may be better for *some* Comet/long-poll stuff | |
| tcp_nodelay off; # on may be better for some Comet/long-poll stuff | |
| gzip on; | |
| gzip_http_version 1.0; | |
| gzip_proxied any; | |
| gzip_min_length 500; | |
| gzip_disable "MSIE [1-6]\."; | |
| gzip_types text/plain text/html text/xml text/css | |
| text/comma-separated-values | |
| text/javascript application/x-javascript | |
| application/atom+xml; | |
| server { | |
| listen 80; | |
| server_name hrysd.org; | |
| access_log logs/host.access.log main; | |
| add_header X-Frame-Options DENY; | |
| add_header X-Content-Type-Options nosniff; | |
| root /home/hrysd/app/hrysd/current/public; | |
| location / { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_redirect off; | |
| proxy_pass http://localhost:4545; | |
| } | |
| location ~ ^/(assets|images|css|javascripts|stylesheets|swfs|system)/ { | |
| expires max; | |
| add_header Cache-Control public; | |
| } | |
| error_page 500 502 503 504 /500.html; | |
| location = /500.html { | |
| root /home/hrysd/app/hrysd/current/public; | |
| } | |
| } | |
| # another virtual host using mix of IP-, name-, and port-based configuration | |
| server { | |
| listen 80; | |
| server_name RAILS.hrysd.org; | |
| #httpでファイルアップロードの上限default1mb | |
| #client_max_body_size 4G; | |
| #キープアライブ接続を切断する前に待つ秒数 | |
| #keepalive_timeout 5; | |
| access_log logs/access.log main; | |
| add_header X-Frame-Options DENY; | |
| add_header X-Content-Type-Options nosniff; | |
| #path to static files | |
| root /home/hrysd/app/fav/current/public; | |
| location / { | |
| # バックエンドサーバーに送られるヘッダの値を定義し直す。 | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| # バックエンドサーバーがリダイレクトを行ったときにlocationヘッダのURLをどうするか。 | |
| proxy_redirect off; | |
| # 振り分け先のアプリケーションを指定 | |
| proxy_pass http://localhost:8080; | |
| } | |
| # Rails static pages | |
| location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ { | |
| expires max; | |
| add_header Cache-Control public; | |
| } | |
| # Rails error pages | |
| error_page 500 502 503 504 /500.html; | |
| location = /500.html { | |
| root /home/hrysd/app/fav/current/public; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment