11   11   11
11   11   11
11   11   11
11   11   11
11   11   11
11   11   11
11   11   11
11   11   11
./configure --without-http_charset_module 

                      --without-http_ssi_module 

                      --without-http_autoindex_module 

                      --without-http_geo_module 

                      --without-http_map_module 

                      --without-http_fastcgi_module 

                      --without-http_memcached_module 

                      --without-http_browser_module 

                      --without-http_upstream_ip_hash_module 

                      --without-http_userid_module 

                      --without-http_empty_gif_module 

                      --without-http_scgi_module 

                      --without-http_uwsgi_module 

                      --with-http_stub_status_module

11   11   11
user     www www;



          error_log     logs/error.log;

          pid           /var/run/nginx.pid;

          worker_rlimit_nofile 200000;

          worker_processes 2;



          events {

                 use epoll;

                 worker_connections   10000;

          # max_connections =

          #     worker_processes * worker_connections / 4 (reverce proxy)

          }



11   11   11
http {

               include                 mime.types;

               default_type            text/html;

               sendfile                on;     tcp_nopush                on;

               send_timeout            10;     keepalive_timeout         5 3;

               keepalive_requests      10;     output_buffers            1 64k;

               postpone_output         1460;

               client_header_timeout   5;      client_body_timeout       5;

               client_body_temp_path        /dev/shm/nginx/client_temp 1 1;

               client_max_body_size    1m;     client_body_buffer_size          32k;

               client_header_buffer_size        2k;

               large_client_header_buffers      4 8k;

               proxy_temp_path /dev/shm/nginx/proxy_temp 1 1;



11   11   11
#snip: log format definitions

          server {

               listen 80;

               server_name _;



               access_log    logs/sorry.access_log   main;



               location /___nginx_status {

                     stub_status on;

                     allow 10.0.0.0/8;

                     allow 127.0.0.1;

                     deny all;

               }


11   11   11
set $agent "pc";

                 if ($http_user_agent ~ '^DoCoMo/[0-9].[0-9][ /]') {

                     set $agent "mobile";

                 }

                 if ($http_user_agent ~ '^SoftBank/[0-9].[0-9]') {

                     set $agent "mobile";

                 }

               ### snip: various careers...

                 if ($http_user_agent ~ '^ASTEL/') {

                     set $agent "mobile";

                 }




11   11   11
location ^~ /maintenance/ {

                   root /home/tagomoris/for-sorry-blog/resources/pcsp/;

                   if ($agent = mobile) {

                       root /home/tagomoris/for-sorry-blog/resources/mobile/;

                   }



                   index /maintenance/maintenance.html;

               }

               location / {

                   # 'redirect' means 302 (temporarily moved)

                   rewrite '^.*$' /maintenance/maintenance.html redirect;

               }

          } #server


11   11   11
11   11   11
11   11   11
11   11   11

livedoor blogのsorryサーバの話 #study2study

  • 1.
    11 11 11
  • 2.
    11 11 11
  • 3.
    11 11 11
  • 4.
    11 11 11
  • 5.
    11 11 11
  • 6.
    11 11 11
  • 7.
    11 11 11
  • 8.
    11 11 11
  • 9.
    ./configure --without-http_charset_module --without-http_ssi_module --without-http_autoindex_module --without-http_geo_module --without-http_map_module --without-http_fastcgi_module --without-http_memcached_module --without-http_browser_module --without-http_upstream_ip_hash_module --without-http_userid_module --without-http_empty_gif_module --without-http_scgi_module --without-http_uwsgi_module --with-http_stub_status_module 11 11 11
  • 10.
    user www www; error_log logs/error.log; pid /var/run/nginx.pid; worker_rlimit_nofile 200000; worker_processes 2; events { use epoll; worker_connections 10000; # max_connections = # worker_processes * worker_connections / 4 (reverce proxy) } 11 11 11
  • 11.
    http { include mime.types; default_type text/html; sendfile on; tcp_nopush on; send_timeout 10; keepalive_timeout 5 3; keepalive_requests 10; output_buffers 1 64k; postpone_output 1460; client_header_timeout 5; client_body_timeout 5; client_body_temp_path /dev/shm/nginx/client_temp 1 1; client_max_body_size 1m; client_body_buffer_size 32k; client_header_buffer_size 2k; large_client_header_buffers 4 8k; proxy_temp_path /dev/shm/nginx/proxy_temp 1 1; 11 11 11
  • 12.
    #snip: log formatdefinitions server { listen 80; server_name _; access_log logs/sorry.access_log main; location /___nginx_status { stub_status on; allow 10.0.0.0/8; allow 127.0.0.1; deny all; } 11 11 11
  • 13.
    set $agent "pc"; if ($http_user_agent ~ '^DoCoMo/[0-9].[0-9][ /]') { set $agent "mobile"; } if ($http_user_agent ~ '^SoftBank/[0-9].[0-9]') { set $agent "mobile"; } ### snip: various careers... if ($http_user_agent ~ '^ASTEL/') { set $agent "mobile"; } 11 11 11
  • 14.
    location ^~ /maintenance/{ root /home/tagomoris/for-sorry-blog/resources/pcsp/; if ($agent = mobile) { root /home/tagomoris/for-sorry-blog/resources/mobile/; } index /maintenance/maintenance.html; } location / { # 'redirect' means 302 (temporarily moved) rewrite '^.*$' /maintenance/maintenance.html redirect; } } #server 11 11 11
  • 15.
    11 11 11
  • 16.
    11 11 11
  • 17.
    11 11 11