From 75a23c6c7e131d090c317f69bfb09d7b722f63ee Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Sun, 19 Oct 2014 18:09:01 +0900
Subject: [PATCH] Add sample nghttpx logrotate configuration

---
 contrib/Makefile.am       |  2 +-
 contrib/nghttpx-logrotate | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 contrib/nghttpx-logrotate

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 00e89fd5..6727a846 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -21,7 +21,7 @@
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-EXTRA_DIST = nghttpx-init.in
+EXTRA_DIST = nghttpx-init.in nghttpx-logrotate
 
 edit = sed -e 's|@bindir[@]|$(bindir)|g'
 
diff --git a/contrib/nghttpx-logrotate b/contrib/nghttpx-logrotate
new file mode 100644
index 00000000..56b37be6
--- /dev/null
+++ b/contrib/nghttpx-logrotate
@@ -0,0 +1,18 @@
+/var/log/nghttpx/*.log {
+        weekly
+        missingok
+        rotate 52
+        compress
+        delaycompress
+        notifempty
+        create 0640 www-data adm
+        sharedscripts
+        prerotate
+                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
+                        run-parts /etc/logrotate.d/httpd-prerotate; \
+                fi \
+        endscript
+        postrotate
+                [ -s /run/nghttpx.pid ] && kill -USR1 `cat /run/nghttpx.pid`
+        endscript
+}
-- 
2.26.2