{"id":1004,"date":"2011-02-03T20:49:55","date_gmt":"2011-02-03T11:49:55","guid":{"rendered":"http:\/\/www.kazu.tv\/blog\/?p=1004"},"modified":"2011-02-03T20:49:55","modified_gmt":"2011-02-03T11:49:55","slug":"nginx","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2011\/02\/03\/nginx\/","title":{"rendered":"nginx"},"content":{"rendered":"<p>\u4ed5\u4e8b\u3067\u521d\u3081\u3066Ruby on Rails\u3092\u3084\u3063\u3066\u308b\u3002nginx + unicorn\u3092\u4f7f\u3063\u3066\u308b\u3093\u3060\u3051\u3069\u3001\u4eca\u56de\u306fnginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30fb\u8a2d\u5b9a\u307e\u3067\u3002<\/p>\n<h3>\u25a0nginx + unicorn\u306b\u6c7a\u3081\u305f\u7d4c\u7def<\/h3>\n<p>\u3064\u3044\u3067\u306b\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u306e\u69cb\u7bc9\u307e\u3067\u983c\u307e\u308c\u305f\u306e\u3067\u3001\u8abf\u3079\u3066\u307f\u308b\u3068\u3001\u6700\u8fd1\u306funicorn\u3063\u3066\u306e\u304c\u4eba\u6c17\u3089\u3057\u3044\u3002\u5927\u6614\u306bRoR\u304c\u6d41\u884c\u59cb\u3081\u305f\u9803\u306fMongrel\u304c\u4eba\u6c17\u304c\u3042\u3063\u305f\u3088\u3046\u3060\u3051\u3069\u3002\u307e\u3041\u3001\u3088\u304f\u5206\u304b\u3089\u306a\u3044\u3051\u3069\u3061\u3087\u3063\u3068\u8abf\u3079\u3066\u307f\u305f\u6240\u8a55\u5224\u826f\u3055\u305d\u3046\u306a\u3093\u3067\u3001unicorn\u3092\u4f7f\u3046\u4e8b\u3092\u6c7a\u5b9a\u3002<\/p>\n<p>\u6b21\u306b\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u3002Apache\u306f\u4eca\u307e\u3067\u6ca2\u5c71\u4f7f\u3063\u3066\u304d\u305f\u306e\u3067\u3001nginx\u3092\u4f7f\u3046\u4e8b\u306b\u3057\u305f\u3002<\/p>\n<p>\u74b0\u5883\u306fCentOS 5.0 \uff08\u8af8\u4e8b\u60c5\u306b\u3088\u308a&hellip;\uff09<\/p>\n<p><!--more--><\/p>\n<h3>\u25a0nginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb &rarr; \u30a8\u30e9\u30fc<\/h3>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306bEPEL\u306e\u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; code\">\n$ sudo rpm -Uvh http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<\/pre>\n<p>\u5f8c\u306fyum install nginx\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3060\u3051\u3002<\/p>\n<p>\u3068\u8a00\u3044\u305f\u3044\u6240\u306a\u3093\u3060\u3051\u3069\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u3053\u306eRPM\u3060\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u3092\u5410\u3044\u3066\u52d5\u304b\u306a\u3044\u3002<\/p>\n<pre class=\"brush: plain; code\">\n2011\/02\/01 10:47:18 [emerg] 17484#0: eventfd() failed (38: Function not implemented)\n2011\/02\/01 10:47:18 [alert] 17483#0: worker process 17484 exited with fatal code 2 and can not be respawn\n<\/pre>\n<p>kernel\u306beventfd()\u3068\u3044\u3046\u30b7\u30b9\u30c6\u30e0\u30b3\u30fc\u30eb\u304c\u7121\u3044\u3068\u8d77\u304d\u308b\u3089\u3057\u3044\u3002\u4ed6\u306e\u74b0\u5883\u3067\u4f7f\u3063\u3066\u3044\u308bCentOS 5.5\u3060\u3068\u554f\u984c\u306a\u304b\u3063\u305f\u3051\u3069\u3002nginx\u306e\u30d5\u30a9\u30fc\u30e9\u30e0\u306b\u3082\u540c\u3058\u3088\u3046\u306a\u8cea\u554f\u304c\u3044\u304f\u3064\u304b<a href=\"http:\/\/forum.nginx.org\/read.php?2,167356,167356\" target=\"_blank\">\u3042\u3063\u305f<\/a>\u3002<\/p>\n<h3>\u25a0RPM\u30ea\u30d3\u30eb\u30c9<\/h3>\n<p>\u89e3\u6c7a\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001SRPM\u3092\u53d6\u3063\u3066\u304d\u3066\u3001configure\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u5909\u66f4\u3057\u3066\u30ea\u30d3\u30eb\u30c9\u3002<\/p>\n<pre class=\"brush: plain; code\">\n$ wget http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/SRPMS\/nginx-0.8.53-1.el5.src.rpm\n$ sudo rpm -ivh nginx-0.8.53-1.el5.src.rpm<\/pre>\n<p>nginx.spec\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4<\/p>\n<pre class=\"brush: plain; code\">\n$ diff -u nginx.spec.org nginx.spec\n--- nginx.spec.org      2010-11-01 07:52:13.000000000 +0900\n+++ nginx.spec  2011-02-01 11:08:44.000000000 +0900\n@@ -94,7 +94,6 @@\n--with-http_stub_status_module \n--with-http_perl_module \n--with-mail \n-    --with-file-aio \n--with-mail_ssl_module \n--with-ipv6 \n--with-cc-opt=&quot;%{optflags} $(pcre-config --cflags)&quot; <\/pre>\n<p>\u5fc5\u8981\u306adevel\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u3066\u30ea\u30d3\u30eb\u30c9<\/p>\n<pre class=\"brush: plain; code\">\n$ sudo yum install pcre-devel GeoIP-devel ...\n$ sudo rpmbuild -bb nginx.spec<\/pre>\n<p>EPEL\u306eRPM\u3092\u524a\u9664\u3057\u3001\u30ea\u30d3\u30eb\u30c9\u3067\u51fa\u6765\u4e0a\u304c\u3063\u305fRPM\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre class=\"brush: plain; code\">\n$ sudo rpm -e nginx\n\u8b66\u544a: \/etc\/nginx\/nginx.conf \u306f \/etc\/nginx\/nginx.conf.rpmsave \u3068\u3057\u3066\u4fdd\u5b58\u3055\u308c\u3057\u305f \u3002\n$ sudo rpm -ivh nginx-0.8.53-1.i686.rpm<\/pre>\n<h3>\u25a0unicorn\u3068\u306e\u9023\u643a<\/h3>\n<p>unicorn\u306flocalhost\u306e\u30dd\u30fc\u30c85000\u756a\u3067\u52d5\u304f\u3082\u306e\u3068\u3059\u308b\u3002nginx.conf\u306b\u5c11\u3057\u8a18\u8ff0\u3059\u308b\u3060\u3051\u306a\u3093\u3067\u3001\u305d\u3093\u306a\u306b\u96e3\u3057\u304f\u306a\u3044\u3002\u4e00\u5fdc<\/p>\n<pre class=\"brush: plain; code\">\n# unicorn\u30b5\u30fc\u30d0\u30fc\u306e\u60c5\u5831\u3002\u540d\u524d &quot;backend-unicorn&quot; \u306f\u4efb\u610f\u306e\u540d\u524d\u3002\nupstream backend-unicorn {\nserver 127.0.0.1:5000;\n}\n# \u30b5\u30fc\u30d0\u30fc\u5168\u822c\u306e\u5b9a\u7fa9\nserver {\nlocation \/ {\nroot   \/usr\/share\/nginx\/html;\nindex  index.html index.htm;\n# \/usr\/share\/nginx\/html\u5185\u306b\u8a72\u5f53\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u7121\u3044\u5834\u5408\u3001\n# backend-unicorn\u306b\u51e6\u7406\u3092\u6e21\u3059\n# Then request it from the unicorn server\nif (!-f $request_filename) {\nproxy_pass http:\/\/backend-unicorn;\nbreak;\n}\n}\n<\/pre>\n<p>&nbsp;\u3053\u308c\u3067\u5b8c\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ed5\u4e8b\u3067\u521d\u3081\u3066Ruby on Rails\u3092\u3084\u3063\u3066\u308b\u3002nginx + unicorn\u3092\u4f7f\u3063\u3066\u308b\u3093\u3060\u3051\u3069\u3001\u4eca\u56de\u306fnginx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30fb\u8a2d\u5b9a\u307e\u3067\u3002 \u25a0nginx + unicorn\u306b\u6c7a\u3081\u305f\u7d4c\u7def \u3064\u3044\u3067\u306b\u30b5\u30fc\u30d0\u30fc\u74b0\u5883\u306e\u69cb\u7bc9\u307e\u3067&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[864,865,500,866,867],"class_list":["post-1004","post","type-post","status-publish","format-standard","hentry","category-15","tag-eventfd","tag-nginx","tag-rpm","tag-rpmbuild","tag-unicorn"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=1004"}],"version-history":[{"count":0,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1004\/revisions"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=1004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=1004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=1004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}