Skip to content

Setup logrotate for nginx under windows

Create a batch script for the logrotate and save it as nginx_logrotate.bat


rem get date in format ddMMyyyyhhmmss
set dt=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
set dt=%dt: =0%
rem move the current logfiles
move F:\Programme\nginx\logs\Access.log F:\Programme\nginx\logs\Access%dt%.log
move F:\Programme\nginx\logs\Error.log F:\Programme\nginx\logs\Error%dt%.log
rem tell nginx to write new logfiles
cd F:\Programme\nginx\
call F:\Programme\nginx\nginx.exe -p F:\Programme\nginx\ -s reopen

Then you can create a basic windows scheduler task which starts this batch script.

If you run nginx as a windows service, make sure to execute the windows scheduler with the same user as the nginx windows service is running.


When you’re getting the following error:  could not open error log file: CreateFile() "F:\Programme\nginx\nginx.exe/logs/error.log" failed (3: The system cannot find the path specified), make sure to not add nginx.exe to the –p parameter value

Trackbacks

먹튀검증 on : 먹튀검증

Show preview
blog topic

Comments

Display comments as Linear | Threaded

best drywall company in omaha on :

Hello, there. I know this is off-topic, but I was wondering which blog platform are you using for this site?

halifax removals on :

Wow this is good information to know. Thanks for sharing!

my website on :

In humans, the clitoris has been firmly tied to sexual pleasure, though … and this notion was initially brought to public attention only a few years ago .

moving on :

Interested to see how this partnership continues. Thanks for letting us know!

our site on :

Some years ago, 38-year-old Karla Faye Tucker became the first woman ... Most generally, utilitarianism is the moral theory that an action is morally right if it serves ... We recognize pleasure as the first good, being natural to us, and it is from ... First, in Hutcheson's words, we are to compute the consequences of our actions.

Removals Bradford on :

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.

click here on :

Excellent website and information shared. Thank you. https://proremovalsrotherham.co.uk

removals wakefield on :

This is very useful, although it will be important to help simply click that web page!.

our company on :

I might suggest solely beneficial in addition to trusted facts, and so find it:

pro removals rochdale on :

Very good topic, similar texts are I do not know if they are as good as your work out.

pro removals harrogate on :

hello have a nice day, this website is perfect because is a good article and good design, thanks this create website.

Website on :

I recently pen tested this utility but didn’t know much about it

Professional Logo Design on :

I was glad to reveal this incredible site. I have to thank you for your time because of this fabulous read, it was a very fulfilling subject. Logozel is providing you the best Professional Logo Design with customer satisfaction and at an amazing price rate visit Logozel for more details.

Tree Trimming Sumter on :

never really been a batch script type of guy, but if you have to for the setup process then so be it.

patio tiling on :

Most importantly, we will give our inputs to make your idea a little more appealing.

Go to url on :

I gotta favorite this website it seems invaluable extremely helpful…

septic services on :

Very informative post, thanks for sharing this here.

Fleet services on :

Glad to see your site which I like the content of it.

s9 case on :

Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.

Mario Lex on :

Can this script be used on Linux?

Lawn Care on :

I am having some trouble with this code on certain programming tables. Does it work better under certain specific circumstances?

Tree Cutting on :

Such a great help! I really like it! Thank you for sharing!

24 hour Towing on :

This is awesome! Kinda complicated yet very helpful. Good article! Thanks!

aalia sharma on :

I really like the way you have shared such an informative article and I hope for more in the future also. It is a good thing to be here on this website as well.

alisha jonwal on :

All the information in this post is awesome and very interesting. Also, I am very glad to see this kind of brilliant post. https://www.kavya-arora.in/

Handyman on :

Interesting share and great site-thank you!

Add Comment

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Markdown format allowed
Form options