CodeIgniterのダウンロード
root@hostname:/usr/local/src# wget -d https://ellislab.com/codeigniter/download 2014-09-06 21:55:12 (11.9 MB/s) - `download' へ保存完了 [2327811/2327811] root@hostname:/usr/local/src# cd /var/www/htdocs root@hostname:/var/www/htdocs# unzip /usr/local/src/download root@hostname:/var/www/htdocs# chown -R www-data:www-data CodeIgniter_2.2.0 root@hostname:/var/www/htdocs# mv CodeIgniter_2.2.0 CI
CodeIgniterの設定
### Hello World! ### root@hostname:/var/www/htdocs# vi application/controllers/blog.php ====== <?php class Blog extends CI_Controller { public function index() { echo 'Hello World!'; } } ?> ====== root@hostname:/var/www/htdocs# chown www-data:www-data application/controllers/blog.php ### config.phpの$config['base_url']・$config['index_page']の変更 ### root@hostname:/var/www/htdocs/CI# vi application/config/config.php
nginxの設定
rewriteとtry_fileを利用している設定があったため比較してみた
location内でのifは問題を起こすことがある(IfIsEvil)
try_fileの方が高速に動作する(おそらくrewriteはif文処理に時間がかかるため)
公式サイトでもtry_fileを利用しているため、try_fileが良さそう
rewrite編
server { listen 80; ## listen for ipv4; this line is default and implied root /var/www/htdocs/CI; index index.php index.html; server_name 49.212.204.46; # logを取得 access_log /var/log/nginx/CI/access.log; error_log /var/log/nginx/CI/error.log debug; rewrite_log on; location / { if (-f $request_filename) { #expires 30d; break; } if (!-e $request_filename) { rewrite ^(.*)$ /index.php?q=$1 last; # redirectとすることでブラウザにrewriteしたアドレスを表示させることが可能 # ただしredirectは新しいURIを処理せず、302を返却するだけなのであまり意味がない } } location ~ application/.* { deny all; } location ~ system/.* { deny all; } location ~ /\.ht { deny all; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }
他のサーバからアクセスすると
root@hostname2:/# curl --dump-header - http://49.212.204.46/blog HTTP/1.1 200 OK Server: nginx/1.2.1 Date: Sat, 06 Sep 2014 16:55:53 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.4.4-14+deb7u14 Hello World!
rewrite編-log-
error_logをdebugにしているため、詳細なログが出力される
2014/09/07 01:55:53 [debug] 21883#0: post event 000000000225B320 2014/09/07 01:55:53 [debug] 21883#0: delete posted event 000000000225B320 2014/09/07 01:55:53 [debug] 21883#0: accept on 0.0.0.0:80, ready: 0 2014/09/07 01:55:53 [debug] 21883#0: posix_memalign: 0000000002185760:256 @16 2014/09/07 01:55:53 [debug] 21883#0: *1 accept: 49.212.146.190 fd:20 ■アクセス元IPアドレス 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer add: 20: 60000:1410022613631 2014/09/07 01:55:53 [debug] 21883#0: *1 epoll add event: fd:20 op:1 ev:80000001 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 malloc: 00000000021936C0:1312 2014/09/07 01:55:53 [debug] 21883#0: *1 posix_memalign: 00000000022556F0:256 @16 2014/09/07 01:55:53 [debug] 21883#0: *1 malloc: 0000000002193BF0:1024 2014/09/07 01:55:53 [debug] 21883#0: *1 posix_memalign: 0000000002194000:4096 @16 2014/09/07 01:55:53 [debug] 21883#0: *1 http process request line 2014/09/07 01:55:53 [debug] 21883#0: *1 recv: fd:20 169 of 1024 2014/09/07 01:55:53 [debug] 21883#0: *1 http request line: "GET /blog HTTP/1.1" ■HTTP Request 2014/09/07 01:55:53 [debug] 21883#0: *1 http uri: "/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http args: "" 2014/09/07 01:55:53 [debug] 21883#0: *1 http exten: "" 2014/09/07 01:55:53 [debug] 21883#0: *1 http process request header line 2014/09/07 01:55:53 [debug] 21883#0: *1 http header: "User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3" 2014/09/07 01:55:53 [debug] 21883#0: *1 http header: "Host: 49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 http header: "Accept: */*" 2014/09/07 01:55:53 [debug] 21883#0: *1 http header done 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer del: 20: 1410022613631 2014/09/07 01:55:53 [debug] 21883#0: *1 generic phase: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 rewrite phase: 1 ■rewrite処理(phaseで検索すると、rewrite→post rewrite→access→post access と動作していることがわかる) 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: "/" ■locationの選択 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "application/.*" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "system/.*" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "/\.ht" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "\.php$" 2014/09/07 01:55:53 [debug] 21883#0: *1 using configuration "/" ■"/" locationを利用することに 2014/09/07 01:55:53 [debug] 21883#0: *1 http cl:-1 max:1048576 2014/09/07 01:55:53 [debug] 21883#0: *1 rewrite phase: 3 2014/09/07 01:55:53 [debug] 21883#0: *1 rewrite phase: 4 2014/09/07 01:55:53 [debug] 21883#0: *1 http script complex value 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/var/www/htdocs/CI/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "^@" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script file op 0000000000000000 "/var/www/htdocs/CI/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script file op false 2014/09/07 01:55:53 [debug] 21883#0: *1 http script if ■if (-f $request_filename)の検証 2014/09/07 01:55:53 [debug] 21883#0: *1 http script if: false 2014/09/07 01:55:53 [debug] 21883#0: *1 http script complex value 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/var/www/htdocs/CI/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "^@" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script file op 0000000000000005 "/var/www/htdocs/CI/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script if ■if (!-e $request_filename)の検証 2014/09/07 01:55:53 [debug] 21883#0: *1 http script regex: "^(.*)$" 2014/09/07 01:55:53 [notice] 21883#0: *1 "^(.*)$" matches "/blog", client: 49.212.146.190, server: 49.212.204.46, request: "GET /blog HTTP/1.1", host: "49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script args 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "q=" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script capture: "/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script regex end 2014/09/07 01:55:53 [notice] 21883#0: *1 rewritten data: "/index.php", args: "q=/blog", client: 49.212.146.190, server: 49.212.204.46, request: "GET /blog HTTP/1.1", host: "49.212.204.46" ■rewrite結果 2014/09/07 01:55:53 [debug] 21883#0: *1 post rewrite phase: 5 2014/09/07 01:55:53 [debug] 21883#0: *1 uri changes: 11 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: "/" ■locationの選択 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "application/.*" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "system/.*" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "/\.ht" 2014/09/07 01:55:53 [debug] 21883#0: *1 test location: ~ "\.php$" 2014/09/07 01:55:53 [debug] 21883#0: *1 using configuration "\.php$" ■"\.php$" locationを利用することに 2014/09/07 01:55:53 [debug] 21883#0: *1 http cl:-1 max:1048576 2014/09/07 01:55:53 [debug] 21883#0: *1 rewrite phase: 3 2014/09/07 01:55:53 [debug] 21883#0: *1 rewrite phase: 4 2014/09/07 01:55:53 [debug] 21883#0: *1 post rewrite phase: 5 2014/09/07 01:55:53 [debug] 21883#0: *1 generic phase: 6 2014/09/07 01:55:53 [debug] 21883#0: *1 generic phase: 7 2014/09/07 01:55:53 [debug] 21883#0: *1 generic phase: 8 2014/09/07 01:55:53 [debug] 21883#0: *1 access phase: 9 2014/09/07 01:55:53 [debug] 21883#0: *1 access phase: 10 2014/09/07 01:55:53 [debug] 21883#0: *1 access phase: 11 2014/09/07 01:55:53 [debug] 21883#0: *1 access phase: 12 2014/09/07 01:55:53 [debug] 21883#0: *1 post access phase: 13 2014/09/07 01:55:53 [debug] 21883#0: *1 posix_memalign: 000000000218A280:4096 @16 2014/09/07 01:55:53 [debug] 21883#0: *1 http init upstream, client timer: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 epoll add event: fd:20 op:3 ev:80000005 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "QUERY_STRING" ■fastcgiに渡す変数 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "QUERY_STRING: q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "REQUEST_METHOD" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "GET" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "REQUEST_METHOD: GET" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "CONTENT_TYPE" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "CONTENT_TYPE: " 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "CONTENT_LENGTH" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "CONTENT_LENGTH: " 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SCRIPT_FILENAME" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/var/www/htdocs/CI/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SCRIPT_FILENAME: /var/www/htdocs/CI/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SCRIPT_NAME" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SCRIPT_NAME: /index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "REQUEST_URI" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "REQUEST_URI: /blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "DOCUMENT_URI" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "DOCUMENT_URI: /index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "DOCUMENT_ROOT" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "/var/www/htdocs/CI" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "DOCUMENT_ROOT: /var/www/htdocs/CI" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SERVER_PROTOCOL" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "HTTP/1.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SERVER_PROTOCOL: HTTP/1.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "GATEWAY_INTERFACE" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "CGI/1.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "GATEWAY_INTERFACE: CGI/1.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SERVER_SOFTWARE" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "nginx/" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "1.2.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SERVER_SOFTWARE: nginx/1.2.1" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "REMOTE_ADDR" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "49.212.146.190" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "REMOTE_ADDR: 49.212.146.190" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "REMOTE_PORT" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "55564" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "REMOTE_PORT: 55564" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SERVER_ADDR" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SERVER_ADDR: 49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SERVER_PORT" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "80" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SERVER_PORT: 80" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "SERVER_NAME" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "SERVER_NAME: 49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "HTTPS" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script var: "" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "HTTPS: " 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "REDIRECT_STATUS" 2014/09/07 01:55:53 [debug] 21883#0: *1 http script copy: "200" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "REDIRECT_STATUS: 200" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "HTTP_USER_AGENT: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "HTTP_HOST: 49.212.204.46" 2014/09/07 01:55:53 [debug] 21883#0: *1 fastcgi param: "HTTP_ACCEPT: */*" 2014/09/07 01:55:53 [debug] 21883#0: *1 http cleanup add: 0000000002194FE8 2014/09/07 01:55:53 [debug] 21883#0: *1 get rr peer, try: 1 2014/09/07 01:55:53 [debug] 21883#0: *1 socket 21 2014/09/07 01:55:53 [debug] 21883#0: *1 epoll add connection: fd:21 ev:80000005 2014/09/07 01:55:53 [debug] 21883#0: *1 connect to unix:/var/run/php5-fpm.sock, fd:21 #2 ■php-fpmに接続、その後処理 2014/09/07 01:55:53 [debug] 21883#0: *1 connected 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream connect: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 posix_memalign: 0000000002195010:128 @16 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream send request 2014/09/07 01:55:53 [debug] 21883#0: *1 chain writer buf fl:0 s:632 2014/09/07 01:55:53 [debug] 21883#0: *1 chain writer in: 000000000218A8C8 2014/09/07 01:55:53 [debug] 21883#0: *1 writev: 632 2014/09/07 01:55:53 [debug] 21883#0: *1 chain writer out: 0000000000000000 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer add: 21: 60000:1410022613631 2014/09/07 01:55:53 [debug] 21883#0: *1 http finalize request: -4, "/index.php?q=/blog" a:1, c:2 2014/09/07 01:55:53 [debug] 21883#0: *1 http request count:2 blk:0 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000226EC68 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000226ECD0 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000226ECD0 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream request: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream dummy handler 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000226EC68 2014/09/07 01:55:53 [debug] 21883#0: *1 http run request: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream check client, write event:1, "/index.php" 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream recv(): -1 (11: Resource temporarily unavailable) 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000225B4C0 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000226ECD0 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000226ECD0 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream request: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream dummy handler 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000225B4C0 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream request: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream process header 2014/09/07 01:55:53 [debug] 21883#0: *1 malloc: 000000000218B290:4096 2014/09/07 01:55:53 [debug] 21883#0: *1 recv: fd:21 104 of 4096 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 01 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 06 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 01 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 4B 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 05 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record length: 75 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi parser: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi header: "X-Powered-By: PHP/5.4.4-14+deb7u14" 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi parser: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi header: "Content-type: text/html" 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi parser: 1 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi header done 2014/09/07 01:55:53 [debug] 21883#0: *1 uploadprogress error-tracker error: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 xslt filter header 2014/09/07 01:55:53 [debug] 21883#0: *1 HTTP/1.1 200 OK ■レスポンスヘッダを返却 Server: nginx/1.2.1 Date: Sat, 06 Sep 2014 16:55:53 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.4.4-14+deb7u14 2014/09/07 01:55:53 [debug] 21883#0: *1 write new buf t:1 f:0 000000000218AB28, pos 000000000218AB28, size: 190 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http write filter: l:0 f:0 s:190 2014/09/07 01:55:53 [debug] 21883#0: *1 http cacheable: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream process upstream 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe read upstream: 1 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe preread: 33 2014/09/07 01:55:53 [debug] 21883#0: *1 readv: 1:3992 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe recv chain: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe buf free s:0 t:1 f:0 000000000218B290, pos 000000000218B2D7, size: 33 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe length: -1 2014/09/07 01:55:53 [debug] 21883#0: *1 input buf #0 000000000218B2D7 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 01 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 03 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 01 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 08 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record byte: 00 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi record length: 8 2014/09/07 01:55:53 [debug] 21883#0: *1 http fastcgi sent end request 2014/09/07 01:55:53 [debug] 21883#0: *1 input buf 000000000218B2D7 12 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe write downstream: 1 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe write downstream flush in 2014/09/07 01:55:53 [debug] 21883#0: *1 http output filter "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http copy filter: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 image filter 2014/09/07 01:55:53 [debug] 21883#0: *1 xslt filter body 2014/09/07 01:55:53 [debug] 21883#0: *1 http postpone filter "/index.php?q=/blog" 000000000218AD50 2014/09/07 01:55:53 [debug] 21883#0: *1 http chunk: 12 2014/09/07 01:55:53 [debug] 21883#0: *1 write old buf t:1 f:0 000000000218AB28, pos 000000000218AB28, size: 190 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write new buf t:1 f:0 000000000218AE38, pos 000000000218AE38, size: 3 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write new buf t:1 f:0 000000000218B290, pos 000000000218B2D7, size: 12 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000004F2B10, size: 2 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http write filter: l:0 f:0 s:207 2014/09/07 01:55:53 [debug] 21883#0: *1 http copy filter: 0 "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 pipe write downstream done 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer: 21, old: 1410022613631, new: 1410022613647 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream exit: 0000000000000000 2014/09/07 01:55:53 [debug] 21883#0: *1 finalize http upstream request: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 finalize http fastcgi request 2014/09/07 01:55:53 [debug] 21883#0: *1 free rr peer 1 0 2014/09/07 01:55:53 [debug] 21883#0: *1 close http upstream connection: 21 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 0000000002195010, unused: 48 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer del: 21: 1410022613631 2014/09/07 01:55:53 [debug] 21883#0: *1 reusable connection: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http upstream temp fd: -1 2014/09/07 01:55:53 [debug] 21883#0: *1 http output filter "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http copy filter: "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 image filter 2014/09/07 01:55:53 [debug] 21883#0: *1 xslt filter body 2014/09/07 01:55:53 [debug] 21883#0: *1 http postpone filter "/index.php?q=/blog" 00007FFFA47F6DE0 2014/09/07 01:55:53 [debug] 21883#0: *1 http chunk: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write old buf t:1 f:0 000000000218AB28, pos 000000000218AB28, size: 190 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write old buf t:1 f:0 000000000218AE38, pos 000000000218AE38, size: 3 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write old buf t:1 f:0 000000000218B290, pos 000000000218B2D7, size: 12 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write old buf t:0 f:0 0000000000000000, pos 00000000004F2B10, size: 2 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 write new buf t:0 f:0 0000000000000000, pos 00000000004E2DDA, size: 5 file: 0, size: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 http write filter: l:1 f:0 s:212 2014/09/07 01:55:53 [debug] 21883#0: *1 http write filter limit 0 2014/09/07 01:55:53 [debug] 21883#0: *1 writev: 212 2014/09/07 01:55:53 [debug] 21883#0: *1 http write filter 0000000000000000 2014/09/07 01:55:53 [debug] 21883#0: *1 http copy filter: 0 "/index.php?q=/blog" 2014/09/07 01:55:53 [debug] 21883#0: *1 http finalize request: 0, "/index.php?q=/blog" a:1, c:1 2014/09/07 01:55:53 [debug] 21883#0: *1 set http keepalive handler 2014/09/07 01:55:53 [debug] 21883#0: *1 http close request ■http処理終了 2014/09/07 01:55:53 [debug] 21883#0: *1 http log handler 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 000000000218B290 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 0000000002194000, unused: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 000000000218A280, unused: 536 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer add: 20: 65000:1410022618647 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 00000000021936C0 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 0000000002193BF0 2014/09/07 01:55:53 [debug] 21883#0: *1 hc free: 0000000000000000 0 2014/09/07 01:55:53 [debug] 21883#0: *1 hc busy: 0000000000000000 0 2014/09/07 01:55:53 [debug] 21883#0: *1 tcp_nodelay 2014/09/07 01:55:53 [debug] 21883#0: *1 reusable connection: 1 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 http keepalive handler 2014/09/07 01:55:53 [debug] 21883#0: *1 malloc: 00000000021936C0:1024 2014/09/07 01:55:53 [debug] 21883#0: *1 recv: fd:20 -1 of 1024 2014/09/07 01:55:53 [debug] 21883#0: *1 recv() not ready (11: Resource temporarily unavailable) 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 post event 000000000226EC68 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000226EC68 2014/09/07 01:55:53 [debug] 21883#0: *1 http empty handler 2014/09/07 01:55:53 [debug] 21883#0: *1 delete posted event 000000000225B458 2014/09/07 01:55:53 [debug] 21883#0: *1 http keepalive handler 2014/09/07 01:55:53 [debug] 21883#0: *1 recv: fd:20 0 of 1024 2014/09/07 01:55:53 [info] 21883#0: *1 client 49.212.146.190 closed keepalive connection 2014/09/07 01:55:53 [debug] 21883#0: *1 close http connection: 20 2014/09/07 01:55:53 [debug] 21883#0: *1 event timer del: 20: 1410022618647 2014/09/07 01:55:53 [debug] 21883#0: *1 reusable connection: 0 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 00000000021936C0 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 0000000000000000 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 0000000002185760, unused: 8 2014/09/07 01:55:53 [debug] 21883#0: *1 free: 00000000022556F0, unused: 112
rewrite編-性能-
他のサーバからアクセスすると
root@hostname2:/# ab -n 1000 -c 100 http://49.212.204.46/blog Complete requests: 1000 Failed requests: 0 Requests per second: 155.90 [#/sec] (mean) Requests per second: 171.18 [#/sec] (mean) Requests per second: 150.96 [#/sec] (mean)
try_files編
指定されたファイルを送る、なければ最後の引数のURIを返却する
server { listen 80; ## listen for ipv4; this line is default and implied root /var/www/htdocs/CI; index index.php index.html; server_name 49.212.204.46; # logを取得 access_log /var/log/nginx/CI/access.log; error_log /var/log/nginx/CI/error.log debug; rewrite_log on; location / { try_files $uri $uri/ /index.php; } location ~ application/.* { deny all; } location ~ system/.* { deny all; } location ~ /\.ht { deny all; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }
try_files編-log-
error_logをdebugにしているため、詳細なログが出力される
2014/09/07 03:49:25 [debug] 22224#0: post event 0000000002514210 2014/09/07 03:49:25 [debug] 22224#0: delete posted event 0000000002514210 2014/09/07 03:49:25 [debug] 22224#0: accept on 0.0.0.0:80, ready: 0 2014/09/07 03:49:25 [debug] 22224#0: posix_memalign: 0000000002442760:256 @16 2014/09/07 03:49:25 [debug] 22224#0: *24 accept: 49.212.146.190 fd:20 ■アクセス元IPアドレス 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer add: 20: 60000:1410029425319 2014/09/07 03:49:25 [debug] 22224#0: *24 epoll add event: fd:20 op:1 ev:80000001 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 malloc: 00000000024506C0:1312 2014/09/07 03:49:25 [debug] 22224#0: *24 posix_memalign: 000000000250E5E0:256 @16 2014/09/07 03:49:25 [debug] 22224#0: *24 malloc: 0000000002450BF0:1024 2014/09/07 03:49:25 [debug] 22224#0: *24 posix_memalign: 0000000002451000:4096 @16 2014/09/07 03:49:25 [debug] 22224#0: *24 http process request line 2014/09/07 03:49:25 [debug] 22224#0: *24 recv: fd:20 169 of 1024 2014/09/07 03:49:25 [debug] 22224#0: *24 http request line: "GET /blog HTTP/1.1" ■HTTP Request 2014/09/07 03:49:25 [debug] 22224#0: *24 http uri: "/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 http args: "" 2014/09/07 03:49:25 [debug] 22224#0: *24 http exten: "" 2014/09/07 03:49:25 [debug] 22224#0: *24 http process request header line 2014/09/07 03:49:25 [debug] 22224#0: *24 http header: "User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3" 2014/09/07 03:49:25 [debug] 22224#0: *24 http header: "Host: 49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 http header: "Accept: */*" 2014/09/07 03:49:25 [debug] 22224#0: *24 http header done 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer del: 20: 1410029425319 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 1 ■rewrite処理(phaseで検索すると、rewrite→post rewrite→access→post access と動作していることがわかる) 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: "/" ■locationの選択 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "application/.*" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "system/.*" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "/\.ht" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "\.php$" 2014/09/07 03:49:25 [debug] 22224#0: *24 using configuration "/" ■"/" locationを利用することに 2014/09/07 03:49:25 [debug] 22224#0: *24 http cl:-1 max:1048576 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 3 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 4 2014/09/07 03:49:25 [debug] 22224#0: *24 post rewrite phase: 5 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 6 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 7 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 8 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 9 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 10 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 11 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 12 2014/09/07 03:49:25 [debug] 22224#0: *24 post access phase: 13 2014/09/07 03:49:25 [debug] 22224#0: *24 try files phase: 14 ■try_files $uri $uri/ /index.php の検証 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 trying to use file: "/blog" "/var/www/htdocs/CI/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 trying to use dir: "/blog" "/var/www/htdocs/CI/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 trying to use file: "/index.php" "/var/www/htdocs/CI/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 internal redirect: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 1 ■index.phpにrewrite後の動作 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: "/" ■locationの選択 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "application/.*" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "system/.*" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "/\.ht" 2014/09/07 03:49:25 [debug] 22224#0: *24 test location: ~ "\.php$" 2014/09/07 03:49:25 [debug] 22224#0: *24 using configuration "\.php$" ■"\.php$" locationを利用することに 2014/09/07 03:49:25 [debug] 22224#0: *24 http cl:-1 max:1048576 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 3 2014/09/07 03:49:25 [debug] 22224#0: *24 rewrite phase: 4 2014/09/07 03:49:25 [debug] 22224#0: *24 post rewrite phase: 5 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 6 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 7 2014/09/07 03:49:25 [debug] 22224#0: *24 generic phase: 8 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 9 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 10 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 11 2014/09/07 03:49:25 [debug] 22224#0: *24 access phase: 12 2014/09/07 03:49:25 [debug] 22224#0: *24 post access phase: 13 2014/09/07 03:49:25 [debug] 22224#0: *24 try files phase: 14 ■try_files phase 2014/09/07 03:49:25 [debug] 22224#0: *24 posix_memalign: 0000000002447280:4096 @16 2014/09/07 03:49:25 [debug] 22224#0: *24 http init upstream, client timer: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 epoll add event: fd:20 op:3 ev:80000005 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "QUERY_STRING" ■fastcgiに渡す変数 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "QUERY_STRING: " 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "REQUEST_METHOD" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "GET" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "REQUEST_METHOD: GET" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "CONTENT_TYPE" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "CONTENT_TYPE: " 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "CONTENT_LENGTH" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "CONTENT_LENGTH: " 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SCRIPT_FILENAME" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/var/www/htdocs/CI/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SCRIPT_FILENAME: /var/www/htdocs/CI/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SCRIPT_NAME" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SCRIPT_NAME: /index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "REQUEST_URI" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "REQUEST_URI: /blog" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "DOCUMENT_URI" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "DOCUMENT_URI: /index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "DOCUMENT_ROOT" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "/var/www/htdocs/CI" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "DOCUMENT_ROOT: /var/www/htdocs/CI" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SERVER_PROTOCOL" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "HTTP/1.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SERVER_PROTOCOL: HTTP/1.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "GATEWAY_INTERFACE" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "CGI/1.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "GATEWAY_INTERFACE: CGI/1.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SERVER_SOFTWARE" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "nginx/" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "1.2.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SERVER_SOFTWARE: nginx/1.2.1" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "REMOTE_ADDR" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "49.212.146.190" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "REMOTE_ADDR: 49.212.146.190" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "REMOTE_PORT" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "58634" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "REMOTE_PORT: 58634" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SERVER_ADDR" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SERVER_ADDR: 49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SERVER_PORT" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "80" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SERVER_PORT: 80" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "SERVER_NAME" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "SERVER_NAME: 49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "HTTPS" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script var: "" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "HTTPS: " 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "REDIRECT_STATUS" 2014/09/07 03:49:25 [debug] 22224#0: *24 http script copy: "200" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "REDIRECT_STATUS: 200" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "HTTP_USER_AGENT: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "HTTP_HOST: 49.212.204.46" 2014/09/07 03:49:25 [debug] 22224#0: *24 fastcgi param: "HTTP_ACCEPT: */*" 2014/09/07 03:49:25 [debug] 22224#0: *24 http cleanup add: 0000000002447700 2014/09/07 03:49:25 [debug] 22224#0: *24 get rr peer, try: 1 2014/09/07 03:49:25 [debug] 22224#0: *24 socket 21 2014/09/07 03:49:25 [debug] 22224#0: *24 epoll add connection: fd:21 ev:80000005 2014/09/07 03:49:25 [debug] 22224#0: *24 connect to unix:/var/run/php5-fpm.sock, fd:21 #25 ■php-fpmに接続、その後処理 2014/09/07 03:49:25 [debug] 22224#0: *24 connected 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream connect: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 posix_memalign: 0000000002452010:128 @16 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream send request 2014/09/07 03:49:25 [debug] 22224#0: *24 chain writer buf fl:0 s:624 2014/09/07 03:49:25 [debug] 22224#0: *24 chain writer in: 0000000002447738 2014/09/07 03:49:25 [debug] 22224#0: *24 writev: 624 2014/09/07 03:49:25 [debug] 22224#0: *24 chain writer out: 0000000000000000 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer add: 21: 60000:1410029425320 2014/09/07 03:49:25 [debug] 22224#0: *24 http finalize request: -4, "/index.php?" a:1, c:3 2014/09/07 03:49:25 [debug] 22224#0: *24 http request count:3 blk:0 2014/09/07 03:49:25 [debug] 22224#0: *24 http finalize request: -4, "/index.php?" a:1, c:2 2014/09/07 03:49:25 [debug] 22224#0: *24 http request count:2 blk:0 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 0000000002527BC0 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 0000000002527B58 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 0000000002527B58 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream request: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream dummy handler 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 0000000002527BC0 2014/09/07 03:49:25 [debug] 22224#0: *24 http run request: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream check client, write event:1, "/index.php" 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream recv(): -1 (11: Resource temporarily unavailable) 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 0000000002514348 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 0000000002527B58 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 0000000002527B58 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream request: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream dummy handler 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 0000000002514348 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream request: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream process header 2014/09/07 03:49:25 [debug] 22224#0: *24 malloc: 0000000002448290:4096 2014/09/07 03:49:25 [debug] 22224#0: *24 recv: fd:21 104 of 4096 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 01 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 06 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 01 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 4B 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 05 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record length: 75 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi parser: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi header: "X-Powered-By: PHP/5.4.4-14+deb7u14" 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi parser: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi header: "Content-type: text/html" 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi parser: 1 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi header done 2014/09/07 03:49:25 [debug] 22224#0: *24 uploadprogress error-tracker error: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 xslt filter header 2014/09/07 03:49:25 [debug] 22224#0: *24 HTTP/1.1 200 OK ■レスポンスヘッダを返却 Server: nginx/1.2.1 Date: Sat, 06 Sep 2014 18:49:25 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.4.4-14+deb7u14 2014/09/07 03:49:25 [debug] 22224#0: *24 write new buf t:1 f:0 0000000002447998, pos 0000000002447998, size: 190 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http write filter: l:0 f:0 s:190 2014/09/07 03:49:25 [debug] 22224#0: *24 http cacheable: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream process upstream 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe read upstream: 1 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe preread: 33 2014/09/07 03:49:25 [debug] 22224#0: *24 readv: 1:3992 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe recv chain: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe buf free s:0 t:1 f:0 0000000002448290, pos 00000000024482D7, size: 33 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe length: -1 2014/09/07 03:49:25 [debug] 22224#0: *24 input buf #0 00000000024482D7 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 01 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 03 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 01 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 08 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record byte: 00 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi record length: 8 2014/09/07 03:49:25 [debug] 22224#0: *24 http fastcgi sent end request 2014/09/07 03:49:25 [debug] 22224#0: *24 input buf 00000000024482D7 12 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe write downstream: 1 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe write downstream flush in 2014/09/07 03:49:25 [debug] 22224#0: *24 http output filter "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http copy filter: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 image filter 2014/09/07 03:49:25 [debug] 22224#0: *24 xslt filter body 2014/09/07 03:49:25 [debug] 22224#0: *24 http postpone filter "/index.php?" 0000000002447BC0 2014/09/07 03:49:25 [debug] 22224#0: *24 http chunk: 12 2014/09/07 03:49:25 [debug] 22224#0: *24 write old buf t:1 f:0 0000000002447998, pos 0000000002447998, size: 190 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write new buf t:1 f:0 0000000002447CA8, pos 0000000002447CA8, size: 3 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write new buf t:1 f:0 0000000002448290, pos 00000000024482D7, size: 12 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write new buf t:0 f:0 0000000000000000, pos 00000000004F2B10, size: 2 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http write filter: l:0 f:0 s:207 2014/09/07 03:49:25 [debug] 22224#0: *24 http copy filter: 0 "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 pipe write downstream done 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer: 21, old: 1410029425320, new: 1410029425330 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream exit: 0000000000000000 2014/09/07 03:49:25 [debug] 22224#0: *24 finalize http upstream request: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 finalize http fastcgi request 2014/09/07 03:49:25 [debug] 22224#0: *24 free rr peer 1 0 2014/09/07 03:49:25 [debug] 22224#0: *24 close http upstream connection: 21 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002452010, unused: 48 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer del: 21: 1410029425320 2014/09/07 03:49:25 [debug] 22224#0: *24 reusable connection: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http upstream temp fd: -1 2014/09/07 03:49:25 [debug] 22224#0: *24 http output filter "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http copy filter: "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 image filter 2014/09/07 03:49:25 [debug] 22224#0: *24 xslt filter body 2014/09/07 03:49:25 [debug] 22224#0: *24 http postpone filter "/index.php?" 00007FFFB7EAD450 2014/09/07 03:49:25 [debug] 22224#0: *24 http chunk: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write old buf t:1 f:0 0000000002447998, pos 0000000002447998, size: 190 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write old buf t:1 f:0 0000000002447CA8, pos 0000000002447CA8, size: 3 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write old buf t:1 f:0 0000000002448290, pos 00000000024482D7, size: 12 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write old buf t:0 f:0 0000000000000000, pos 00000000004F2B10, size: 2 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 write new buf t:0 f:0 0000000000000000, pos 00000000004E2DDA, size: 5 file: 0, size: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 http write filter: l:1 f:0 s:212 2014/09/07 03:49:25 [debug] 22224#0: *24 http write filter limit 0 2014/09/07 03:49:25 [debug] 22224#0: *24 writev: 212 2014/09/07 03:49:25 [debug] 22224#0: *24 http write filter 0000000000000000 2014/09/07 03:49:25 [debug] 22224#0: *24 http copy filter: 0 "/index.php?" 2014/09/07 03:49:25 [debug] 22224#0: *24 http finalize request: 0, "/index.php?" a:1, c:1 2014/09/07 03:49:25 [debug] 22224#0: *24 set http keepalive handler 2014/09/07 03:49:25 [debug] 22224#0: *24 http close request ■http処理終了 2014/09/07 03:49:25 [debug] 22224#0: *24 http log handler 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002448290 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002451000, unused: 6 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002447280, unused: 936 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer add: 20: 65000:1410029430330 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 00000000024506C0 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002450BF0 2014/09/07 03:49:25 [debug] 22224#0: *24 hc free: 0000000000000000 0 2014/09/07 03:49:25 [debug] 22224#0: *24 hc busy: 0000000000000000 0 2014/09/07 03:49:25 [debug] 22224#0: *24 tcp_nodelay 2014/09/07 03:49:25 [debug] 22224#0: *24 reusable connection: 1 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 http keepalive handler 2014/09/07 03:49:25 [debug] 22224#0: *24 malloc: 00000000024506C0:1024 2014/09/07 03:49:25 [debug] 22224#0: *24 recv: fd:20 -1 of 1024 2014/09/07 03:49:25 [debug] 22224#0: *24 recv() not ready (11: Resource temporarily unavailable) 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 post event 0000000002527BC0 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 0000000002527BC0 2014/09/07 03:49:25 [debug] 22224#0: *24 http empty handler 2014/09/07 03:49:25 [debug] 22224#0: *24 delete posted event 00000000025143B0 2014/09/07 03:49:25 [debug] 22224#0: *24 http keepalive handler 2014/09/07 03:49:25 [debug] 22224#0: *24 recv: fd:20 0 of 1024 2014/09/07 03:49:25 [info] 22224#0: *24 client 49.212.146.190 closed keepalive connection 2014/09/07 03:49:25 [debug] 22224#0: *24 close http connection: 20 2014/09/07 03:49:25 [debug] 22224#0: *24 event timer del: 20: 1410029430330 2014/09/07 03:49:25 [debug] 22224#0: *24 reusable connection: 0 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 00000000024506C0 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000000000000 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 0000000002442760, unused: 8 2014/09/07 03:49:25 [debug] 22224#0: *24 free: 000000000250E5E0, unused: 112
try_files編-性能-
他のサーバからアクセスすると
root@hostname2:/# ab -n 1000 -c 100 http://49.212.204.46/blog Complete requests: 1000 Failed requests: 0 Requests per second: 177.36 [#/sec] (mean) Requests per second: 178.49 [#/sec] (mean) Requests per second: 180.77 [#/sec] (mean)
参考
CIダウンロードサイト
https://ellislab.com/codeigniter/user-guide/installation/downloads.html
CI-HelloWorld!
http://codeigniter.jp/user_guide_ja/general/controllers.html#hello
CI-configについて
http://www.ci-guide.info/practical/configuration/config/