{"id":8447,"date":"2021-10-01T14:42:03","date_gmt":"2021-10-01T05:42:03","guid":{"rendered":"http:\/\/www.k-in.co.jp\/niwakan\/?p=8447"},"modified":"2021-11-17T17:13:02","modified_gmt":"2021-11-17T08:13:02","slug":"web-server%e3%81%ae%e7%a7%bb%e8%a1%8c%ef%bc%88%e3%81%9d%e3%81%ae7%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.k-in.co.jp\/niwakan\/archives\/2021\/10\/8447\/","title":{"rendered":"web server\u306e\u79fb\u884c\uff08\u305d\u306e7\uff09\u30ed\u30b0\u306e\u30ed\u30fc\u30c6\u30fc\u30c8\u304c\u3057\u305f\u3044"},"content":{"rendered":"<p>Apache2\u306eLog\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u3066\u601d\u3063\u305f\u3002<br \/>\n\u300c\u30ed\u30b0\u304c\u591a\u3044\u301c\u3001\u78ba\u8a8d\u3057\u8f9b\u3044\u301c\u300d<br \/>\n<!--more--><\/p>\n<p>\u306a\u306e\u3067\u65e9\u901f\u306bGoogle\u5e2b\u5320\u3002<br \/>\n<a href=\"http:\/\/nalab.mind.meiji.ac.jp\/~mk\/knowhow-2020\/node43.html\">43 Apache \u306e\u30ed\u30b0\u306e\u30ed\u30fc\u30c6\u30fc\u30c8<\/a><br \/>\n\u3053\u3061\u3089\u306fMacPorts\u3067\u3082\u89e3\u8aac\u306a\u306e\u3067\u6df7\u4e71\u304c\u7121\u3044\u3002\u5b09\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u5148\u305a\u306flogrotate\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre>sudo port install logrotate<\/pre>\n<p>\u3059\u308b\u3068\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u6700\u5f8c\u306b\u6b21\u306e\u3088\u3046\u306b\u66f8\u304b\u308c\u3066\u3044\u305f\u3002<\/p>\n<pre>  logrotate has the following notes:\r\n    To use logrotate:\r\n    \r\n      * See 'man logrotate' for configuration options.\r\n    \r\n      * Enable daily log rotation with this command.\r\n    \r\n        $ sudo port load logrotate\r\n    \r\n      * To create your own startup item with non-default intervals, build\r\n    logrotate\r\n        without the startupitem variant (-startupitem), copy the example into\r\n    place\r\n        and edit to your liking, then load with launchctl when finished.\r\n    \r\n        $ sudo cp\r\n    \/opt\/local\/share\/logrotate\/org.macports.logrotate.plist.example\r\n    \/Library\/LaunchDaemons\/org.macports.logrotate.plist\r\n    \r\n        $ sudo launchctl load -w\r\n    \/Library\/LaunchDaemons\/org.macports.logrotate.plist<\/pre>\n<p>Google\u5148\u751f\u306b\u7ffb\u8a33\u3057\u3066\u8cb0\u3063\u305f\u3002<\/p>\n<pre>logrotate\u306b\u306f\u6b21\u306e\u6ce8\u610f\u4e8b\u9805\u304c\u3042\u308a\u307e\u3059\u3002\r\nlogrotate\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\uff1a\r\n*\u69cb\u6210\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u306f\u3001\u300cmanlogrotate\u300d\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n*\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3067\u6bce\u65e5\u306e\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u306b\u3057\u307e\u3059\u3002\r\n\u3000\u3000$ sudo port load logrotate\r\n*\u30c7\u30d5\u30a9\u30eb\u30c8\u4ee5\u5916\u306e\u9593\u9694\u3067\u72ec\u81ea\u306e\u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7\u30a2\u30a4\u30c6\u30e0\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001startupitem\u30d0\u30ea\u30a2\u30f3\u30c8\uff08-startupitem\uff09\u3092\u4f7f\u7528\u305b\u305a\u306blogrotate\u3092\u30d3\u30eb\u30c9\u3057\u3001\u4f8b\u3092\u6240\u5b9a\u306e\u5834\u6240\u306b\u30b3\u30d4\u30fc\u3057\u3066\u597d\u307f\u306b\u5408\u308f\u305b\u3066\u7de8\u96c6\u3057\u3001\u7d42\u4e86\u6642\u306blaunchctl\u3092\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002\r\n\u3000\u3000$ sudo cp\r\n\u3000\u3000\u3000\/opt\/local\/share\/logrotate\/org.macports.logrotate.plist.example\r\n     \/Library\/LaunchDaemons\/org.macports.logrotate.plist\r\n\u3000\u3000$ sudo launchctl load -w\r\n\u3000\u3000\u3000\/Library\/LaunchDaemons\/org.macports.logrotate.plist<\/pre>\n<p>\u597d\u307f\u3068\u3057\u3066\u306f\u3001\u666e\u6bb5\u3069\u304a\u308a\u306bLaunchDaemons\u306b\u767b\u9332\u304b\u306a\u301c\u3002<br \/>\n\u305d\u308c\u306b\u3057\u3066\u3082\u3001port\u30b3\u30de\u30f3\u30c9\u3067\u3001\u30c7\u30a4\u30ea\u30fc\u8d77\u52d5\u304c\u3067\u304d\u308b\u3068\u306f\u601d\u308f\u3093\u304b\u3063\u305f\u3002\u6d41\u77f3\u306fport\u5148\u751f\u3001\u7d20\u6674\u3089\u3057\u3044\u3002<\/p>\n<p>\u3064\u3044\u3067\u306a\u306e\u3067\u3001\u30b3\u30d4\u30fc\u3057\u305f\/Library\/LaunchDaemons\/org.macports.logrotate.plist\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3002<\/p>\n<pre>        <key>StartCalendarInterval<\/key>\r\n        <dict>\r\n                <key>Hour<\/key>\r\n                <integer>5<\/integer>\r\n                <key>Minute<\/key>\r\n                <integer>30<\/integer>\r\n        <\/dict><\/pre>\n<p>\u6bce\u65e55\u664230\u5206\u306b\u8d77\u52d5\u3059\u308b\u3088\u3046\u3067\u3059\u3002\u3053\u308c\u306f\u3053\u308c\u3067\u3044\u3044\u3060\u308d\u3046\u3002\u5f04\u308b\u5fc5\u8981\u306f\u7121\u3044\u306a\u3002<br \/>\n\u305d\u3057\u3066\u5b9f\u884c\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3002<\/p>\n<pre>sudo logrotate -f -v \/opt\/local\/etc\/logrotate.d\/httpd<\/pre>\n<p>\u5168\u30ed\u30b0\u304c\u6d88\u3048\u305f\u2026\u2026\u2026\u3069\u3053\u3078\u884c\u3063\u305f\u306e\u3060\uff1f<\/p>\n<p>\u4e0a\u8a18\u30b5\u30a4\u30c8\u3067\u4f7f\u3063\u3066\u3044\u308bapache\u306f\u7d14\u6b63\u306a\u306e\u304b\u3001log\u3092\/var\/log\u306b\u66f8\u304d\u8fbc\u3093\u3067\u3044\u308b\u3088\u3046\u3060\u3002<br \/>\n\u305d\u3053\u306e\u90e8\u5206\u3092\u66f8\u304d\u63db\u3048\u308b\u3002<br \/>\n\u4f55\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u306e\u304b\u6c17\u306b\u306a\u3063\u3066<a href=\"https:\/\/qiita.com\/Esfahan\/items\/a8058f1eb593170855a1\">\u4efb\u610f\u306e\u30ed\u30b0\u3092logrotate\u3092\u4f7f\u3063\u3066\u7ba1\u7406\u3059\u308b<\/a>\u306b\u884c\u304d\u3064\u304d\u3001\u6700\u7d42\u7684\u306b<\/p>\n<pre>\/opt\/local\/var\/log\/apache2\/*log {\r\n    missingok\r\n    notifempty\r\n    rotate 20\r\n    postrotate\r\n        \/bin\/kill -HUP `cat \/opt\/local\/var\/run\/apache2\/httpd.pid  2>\/dev\/null` 2> \/dev\/null || true\r\n    endscript\r\n}<\/pre>\n<p>\u3068\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001path\u306e\u8a18\u8ff0\u9593\u9055\u3048\u304c\u591a\u304b\u3063\u305f\u3002<br \/>\n\u4f55\u5ea6\u3082\u30ed\u30b0\u304c\u6d88\u3048\u3066\u3057\u307e\u3063\u305f\u308a\u3001http.pid\u306e\u5834\u6240\u3092\u9593\u9055\u3048\u3066\u3001apache\u306e\u518d\u8d77\u52d5\u304c\u3067\u304d\u3066\u306a\u304b\u3063\u305f\u308a\u3068\u2026\u2026<\/p>\n<p>\u307e\u3001\u3044\u3064\u3082\u306e\u3053\u3068\u3060\u306a\u3063\uff01<\/p>\n<p>\u3064\u3044\u3067\u306b\u5727\u7e2e\u9001\u4fe1\uff1f\u306e\u8a2d\u5b9a\u3082\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002mod_deflate\u3068mod_filter\u3092\u4f7f\u3046\u305d\u3046\u3060\u3002<br \/>\n\u305d\u3046\u8a00\u3048\u3070\u5927\u6614\u7acb\u3066\u305f\u30b5\u30fc\u30d0\u30fc\u306b\u3082\u3053\u3093\u306a\u306e\u5165\u308c\u3066\u305f\u306a\u3001mod_zip\u3060\u3063\u305f\u304b\uff08\u9060\u3044\u76ee\uff09<br \/>\netc\/apache2\/extra\u306bhttpd-deflate.conf\u3092\u7f6e\u304f\u3002\u5185\u5bb9\u306f\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<pre><IfModule mod_deflate.c>\r\n    DeflateCompressionLevel 1\r\n    <IfModule mod_filter.c>\r\n        FilterDeclare COMPRESS\r\n        FilterProvider COMPRESS DEFLATE \"%{CONTENT_TYPE} =~ m#^text\/#i\"\r\n        FilterProvider COMPRESS DEFLATE \"%{CONTENT_TYPE} =~ m#^application\/(atom\\+xml|javascript|json|rss\\+xml|xml|xhtml\\+xml)#i\"\r\n        FilterProvider COMPRESS DEFLATE \"%{CONTENT_TYPE} =~ m#^image\/(svg\\+xml|vnd\\.microsoft\\.icon)#i\"\r\n        FilterChain COMPRESS\r\n        FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no\r\n        #BrowserMatch ^Mozilla\/4 gzip-only-text\/html\r\n        #BrowserMatch ^Mozilla\/4\\.0[678] no-gzip\r\n        #BrowserMatch \\bMSI[E] !no-gzip !gzip-only-text\/html\r\n        #Header append Vary Accept-Encoding env=!dont-vary\r\n    <\/IfModule>\r\n<\/IfModule><\/pre>\n<p>\u3063\u3066\u304b\u3001<a href=\"https:\/\/jyn.jp\/apache-setting-deflate\/\">\u6b63\u3057\u304f\u5727\u7e2e\u3001\u7d20\u65e9\u304f\u9001\u4fe1\u3001mod_deflate\u306e\u8a2d\u5b9a\u65b9\u6cd5<\/a>\u306e\u5185\u5bb9\u305d\u306e\u307e\u307e\u306a\u3093\u3060\u304c\u2026\u2026<br \/>\n<a href=\"https:\/\/www.mindcircus.jp\/archives\/6009\">[Web] mod_deflate\u306e\u8a2d\u5b9a\u65b9\u6cd5 Apache 2.4\u7cfb [\u9ad8\u901f\u5316]<\/a>\u3082\u89e3\u8aac\u304c\u4e01\u5be7\u3067\u826f\u304b\u3063\u305f\u3093\u3060\u3051\u308c\u3069\u3082\u3001\u3053\u3063\u3061\u306e\u65b9\u304c\u30b3\u30d4\u30da\u3057\u6613\u304b\u3063\u305f\u3093\u3060\u3002<br \/>\nhttp -t\u3067\u69cb\u6587\u30c1\u30a7\u30c3\u30af\u3082\u901a\u3063\u305f\u306e\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u518d\u8d77\u52d5\u3002<br \/>\n\u3044\u304f\u3089\u304b\u65e9\u304f\u306a\u308b\u306e\u304b\u306a\u301c\u3001\u3069\u3046\u3060\u308d\u3046\u306a\u301c\u3001\u30c7\u30a3\u30b9\u30af\u9045\u3044\u3082\u3093\u306a\u3041(^_^;;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache2\u306eLog\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u3066\u601d\u3063\u305f\u3002 \u300c\u30ed\u30b0\u304c\u591a\u3044\u301c\u3001\u78ba\u8a8d\u3057\u8f9b\u3044\u301c\u300d<\/p>\n","protected":false},"author":1,"featured_media":7183,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[115],"tags":[159,165,148,24],"class_list":["post-8447","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-apache","tag-logrotate","tag-server","tag-system"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.k-in.co.jp\/niwakan\/wp-content\/uploads\/2020\/02\/Apache_HTTP_server_logo_2016.png?fit=1200%2C458&ssl=1","_links":{"self":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts\/8447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/comments?post=8447"}],"version-history":[{"count":0,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts\/8447\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/media\/7183"}],"wp:attachment":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/media?parent=8447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/categories?post=8447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/tags?post=8447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}