{"id":788,"date":"2011-03-05T17:03:57","date_gmt":"2011-03-05T09:03:57","guid":{"rendered":"http:\/\/www.jpuyy.com\/blog\/?p=788"},"modified":"2012-12-03T22:10:22","modified_gmt":"2012-12-03T14:10:22","slug":"nginx-usage","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=788","title":{"rendered":"nginx\u5e38\u7528\u914d\u7f6e\u53ca\u64cd\u4f5c"},"content":{"rendered":"<p>\u6b64\u535a\u6587\u610f\u5473\u7740\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86nginx php mysql : <a title=\"nginx\u5b89\u88c5\" href=\"\/?p=764\" target=\"_blank\">http:\/\/jpuyy.com\/?p=764<\/a><\/p>\n<p>0.nginx\u914d\u5236\u6587\u4ef6 \/usr\/local\/nginx\/conf\/nginx.conf<br \/>\n1.\u542f\u52a8nginx # \/usr\/local\/nginx\/sbin\/nginx<br \/>\n2.Nginx \u914d\u7f6e\u6587\u4ef6\u6d4b\u8bd5\uff1a#\/usr\/local\/nginx\/sbin\/nginx -t \/\/Debug \u914d\u7f6e\u6587\u4ef6\u7684\u5173\u952e\u547d\u4ee4\u9700\u8981\u91cd\u70b9\u6491\u63e1<br \/>\n3.\u4f7f\u7528ngx_http_access_module\u9650\u5236ip\u8bbf\u95ee<br \/>\nlocation \/ {<br \/>\ndeny 192.168.1.1;<br \/>\nallow 192.168.1.0\/24;<br \/>\nallow 10.1.1.0\/16;<br \/>\ndeny all;<br \/>\n}<br \/>\n4.Nginx \u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u91cd\u65b0\u52a0\u8f7d<br \/>\n\u65b9\u6cd5\u4e00\uff1a<br \/>\n\u9996\u5148\u67e5\u770b\u8fdb\u7a0bPID\u503c<br \/>\n#ps aux |grep nginx<br \/>\nroot 2643 0.0 0.0 4804 664 ? Ss 16:36 0:00 nginx: master process \/usr\/local\/nginx\/sbin\/nginx<br \/>\n\u5e73\u6ed1\u91cd\u542f,\u8f93\u5165 kill -HUP 2643<\/p>\n<p>\u65b9\u6cd5\u4e8c\uff1a<br \/>\n\u53ef\u4ee5reload\u914d\u7f6e\u6587\u4ef6\uff0c\u4e5f\u7b49\u4e8e\u52a8\u6001\u52a0\u8f7d\u4e86\u3002<br \/>\n#\/usr\/local\/nginx\/sbin\/nginx -s reload<\/p>\n<p>5.\u628anginx\u5f04\u4e3a\u5f00\u673a\u542f\u52a8<\/p>\n<p>Go to \/etc\/init.d and run sudo vim ngnix-passenger.sh<br \/>\n\u5728\u91cc\u9762\u5199\u5165<\/p>\n<p>#!\/bin\/bash<br \/>\n# this script starts the nginx process attached to passenger<br \/>\nsudo \/usr\/local\/nginx\/sbin\/nginx<br \/>\nsudo chmod +x \/etc\/init.d\/ngnix-passenger.sh.<br \/>\nsudo \/etc\/init.d\/ngnix-passenger.sh this will run all the code in the script.<br \/>\nVerify that it launches nginx before continuing.<\/p>\n<p>Then run sudo update-rc.d ngnix-passenger.sh defaults while still in the \/etc\/init.d directory.<br \/>\nOnce all of this is in place, reboot your server and ngnix should now be automatically spawned on startup<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b64\u535a\u6587\u610f\u5473\u7740\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86nginx php mysql : http:\/\/jpuyy.com\/?p=764 0.nginx\u914d\u5236\u6587\u4ef6 \/usr\/local\/nginx\/conf\/nginx.conf 1.\u542f\u52a8nginx # \/usr\/local\/nginx\/sbin\/nginx 2.Nginx \u914d\u7f6e\u6587\u4ef6\u6d4b\u8bd5\uff1a#\/usr\/local\/nginx\/sbin\/nginx -t \/\/Debug \u914d\u7f6e\u6587\u4ef6\u7684\u5173\u952e\u547d\u4ee4\u9700\u8981\u91cd\u70b9\u6491\u63e1 3.\u4f7f\u7528ngx_http_access_module\u9650\u5236ip\u8bbf\u95ee location \/ { deny 192.168.1.1; allow 192.168.1.0\/24; allow 10.1.1.0\/16; deny all; } 4.Nginx \u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u91cd\u65b0\u52a0\u8f7d \u65b9\u6cd5\u4e00\uff1a \u9996\u5148\u67e5\u770b\u8fdb\u7a0bPID\u503c #ps aux |grep nginx root 2643 0.0 0.0 4804 664 ? Ss 16:36 0:00 nginx: master process \/usr\/local\/nginx\/sbin\/nginx \u5e73\u6ed1\u91cd\u542f,\u8f93\u5165 kill -HUP 2643 \u65b9\u6cd5\u4e8c\uff1a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[23],"class_list":["post-788","post","type-post","status-publish","format-standard","hentry","category-linux","tag-summary"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=788"}],"version-history":[{"count":19,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/788\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}