oranie's blog

旧:iをgに変えると・・・なんだっけ・・・

Webサーバ勉強会第4回のお題について


11/11に予定通りやりたいと思います。

Nginxの発表をする人は以下のお題をどれか一つ調べて発表か、
お題以外の事(運用Tipsや性能についてなど)を発表よろしくお願いします!


ATND上で登録した人は、どれをやるかコメントで書いてくださいねー。
で、かぶったら他のを選択して下さい!ATNDは、多分10/27、28には立てますので、
作成次第、ツイッターハッシュタグ #study2study)とこのエントリに追記します。
→ATNDはこちら!!
http://atnd.org/events/21473


■Nginxの基本的な仕組み 枠:2人
・Nginx自体の仕組みについて 1人
Apacheや他のサーバとの簡単な違いについて 1人


■Nginxのインストール解説 枠:2人
http://wiki.nginx.org/NginxInstallOptions#Example_3
を例にして

ソースコードからのインストール手順のまとめ 1人
コンパイルオプションについて 1人
(使用しているモジュールとかの簡単な説明とかも)

お題は以下の例を使って下さい。
./configure \
  --prefix=/usr \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --http-log-path=/var/log/nginx/access.log \
  --http-client-body-temp-path=/var/run/nginx/client/ \
  --http-proxy-temp-path=/var/run/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/run/nginx/fcgi/ \
  --http-uwsgi-temp-path=/var/run/nginx/uwsgi/ \
  --http-scgi-temp-path=/var/run/nginx/scgi/

■Nginxのconfig解説 枠:5人
http://wiki.nginx.org/NginxFullExampleに記載されている内容を分割して。
以下を分割して3人で
nginx.conf
1-24行まで 1人
25-53行まで 1人
54-70行まで 1人

  1 user       www www;
  2 worker_processes  5;
  3 error_log  logs/error.log;
  4 pid        logs/nginx.pid;
  5 worker_rlimit_nofile 8192;
  6
  7 events {
  8   worker_connections  4096;
  9 }
 10
 11 http {
 12   include    conf/mime.types;
 13   include    /etc/nginx/proxy.conf;
 14   include    /etc/nginx/fastcgi.conf;
 15   index    index.html index.htm index.php;
 16
 17   default_type application/octet-stream;
 18   log_format   main '$remote_addr - $remote_user [$time_local]  $status '
 19     '"$request" $body_bytes_sent "$http_referer" '
 20     '"$http_user_agent" "$http_x_forwarded_for"';
 21   access_log   logs/access.log  main;
 22   sendfile     on;
 23   tcp_nopush   on;
 24   server_names_hash_bucket_size 128; # this seems to be required for some vhosts
 25
 26   server { # php/fastcgi
 27     listen       80;
 28     server_name  domain1.com www.domain1.com;
 29     access_log   logs/domain1.access.log  main;
 30     root         html;
 31
 32     location ~ \.php$ {
 33       fastcgi_pass   127.0.0.1:1025;
 34     }
 35   }
 36
 37   server { # simple reverse-proxy
 38     listen       80;
 39     server_name  domain2.com www.domain2.com;
 40     access_log   logs/domain2.access.log  main;
 41
 42     # serve static files
 43     location ~ ^/(images|javascript|js|css|flash|media|static)/  {
 44       root    /var/www/virtual/big.server.com/htdocs;
 45       expires 30d;
 46     }
 47
 48     # pass requests for dynamic content to rails/turbogears/zope, et al
 49     location / {
 50       proxy_pass      http://127.0.0.1:8080;
 51     }
 52   }
 53
 54   upstream big_server_com {
 55     server 127.0.0.3:8000 weight=5;
 56     server 127.0.0.3:8001 weight=5;
 57     server 192.168.0.1:8000;
 58     server 192.168.0.1:8001;
 59   }
 60
 61   server { # simple load balancing
 62     listen          80;
 63     server_name     big.server.com;
 64     access_log      logs/big.server.access.log main;
 65
 66     location / {
 67       proxy_pass      http://big_server_com;
 68     }
 69   }
 70 }

proxy_conf  1人

proxy_redirect          off;
proxy_set_header        Host            $host;
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size    10m;
client_body_buffer_size 128k;
proxy_connect_timeout   90;
proxy_send_timeout      90;
proxy_read_timeout      90;
proxy_buffers           32 4k;

以下のコンフィグを合わせて1人
fastcgi_conf

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
 
fastcgi_index  index.php;
 
fastcgi_param  REDIRECT_STATUS    200;

mime_types

types {
  text/html                             html htm shtml;
  text/css                              css;
  text/xml                              xml rss;
  image/gif                             gif;
  image/jpeg                            jpeg jpg;
  application/x-javascript              js;
  text/plain                            txt;
  text/x-component                      htc;
  text/mathml                           mml;
  image/png                             png;
  image/x-icon                          ico;
  image/x-jng                           jng;
  image/vnd.wap.wbmp                    wbmp;
  application/java-archive              jar war ear;
  application/mac-binhex40              hqx;
  application/pdf                       pdf;
  application/x-cocoa                   cco;
  application/x-java-archive-diff       jardiff;
  application/x-java-jnlp-file          jnlp;
  application/x-makeself                run;
  application/x-perl                    pl pm;
  application/x-pilot                   prc pdb;
  application/x-rar-compressed          rar;
  application/x-redhat-package-manager  rpm;
  application/x-sea                     sea;
  application/x-shockwave-flash         swf;
  application/x-stuffit                 sit;
  application/x-tcl                     tcl tk;
  application/x-x509-ca-cert            der pem crt;
  application/x-xpinstall               xpi;
  application/zip                       zip;
  application/octet-stream              deb;
  application/octet-stream              bin exe dll;
  application/octet-stream              dmg;
  application/octet-stream              eot;
  application/octet-stream              iso img;
  application/octet-stream              msi msp msm;
  audio/mpeg                            mp3;
  audio/x-realaudio                     ra;
  video/mpeg                            mpeg mpg;
  video/quicktime                       mov;
  video/x-flv                           flv;
  video/x-msvideo                       avi;
  video/x-ms-wmv                        wmv;
  video/x-ms-asf                        asx asf;
  video/x-mng                           mng;
}

上は確実に発表出来る枠なので、
その他、性能測定したとか、実際の運用でこうやっているとか、
喋りたい事があれば!!


年末なのでその他サーバ、HTTPプロトコルについてでも可能です!!
もし参加者が少なかったら、上の事も調べて発表してくれると嬉しいです(´Д⊂