By Default NGINX logs all IPs going through the reverse proxy. The log will keep growing in size.
To ease of maintainance and troubleshooting, it is advisable to get NGINX to create a new access.log everyday.
If NGINX is running on Windows this can be accomplished using a BAT file.
Create a new BAT file with the following
REM ECHO %YEAR%
REM ECHO %MONTH%
REM ECHO %DAY%
move C:\nginx\logs\Access.log C:\nginx\logs\Old_Logs\Access_%DATE_FRM%.log
move C:\nginx\logs\Error.log C:\nginx\logs\Old_Logs\Error_%DATE_FRM%.log
call C:\nginx\nginx -p C:\nginx -s reopen
Change the Path to the path of your NGINX Log folder. Also create a new folder in the 'Logs' folder called 'Old_Logs'
Save the BAT file.
We now need to create a Scheduled Task to run this BAT file once a Day.
Create a Basic Task
Daily Task or Weekly depending on how often you want to create a new log.
Choose a Time for it to change logs, i chose 00:00:01 so it would create a new log after midnight.
Next select the location of the BAT file and click next until your seen the screen below.
Make sure to put a tick in the 'Open the properties dialog....' box and click finish.
For The Task to restart NGINX the same user has to run the Task Scheduler and the Service.
Select the correct user in 'Change User or Group' and tick the 'Run with highest privileges' box and click 'ok'.
Next run 'services.msc'
Find your NGINX Service and right click on it 'properties'.
On the 'log on' tab change it from 'Local System Account' to 'This Account' and enter the same username as you did for the Task Scheduler.
Finally click Apply and Ok. And that's it. The task will run, move the access.log to the new folder and rename it with the date. NGINX will then create a new access.log file and repeat.
You own a domain name and you use Cloudflare to proxy your websites, services or something else and now you want to have an email address with your new shiny domain name. Cloudflare doesnt support mail forwarding, some registrars have their own forwarding system but if you use Cloudflare then we need to look at Mailgun.
Once added you need to verify you own the domain and setup the relevent records. Head over to Cloudflare and create the records, they will look similar to the below image.
This is what you will end up with. (Make sure the email CNAME status is the grey cloud!)
Head back to Mailgun. You will need to give the Records we created above some time to propogated across the internet. You can check this by clicking 'Check DNS Records Now'
Creating Routes. In Mailgun we need to specify routes or email addresses. This will define the recipient email and the action to take.
You can create a number of routes or you can create a 'catch all' or both. Priority is like rules, It will match the lowest priority first (lowest number), so if you set a 'catch all' rule set a high number priority e.g. 100. That way it will attempt to match everything else first.
Finally in Mailgun we also need to validated our personal email address, hotmail, gmail or whatever. Head into Account Settings and then Authorised Recipients. Add your email address which will send a link to your email which you need to validate.
Once the DNS settings have been updated and you have validated your email you should now be able to receive any emails sent to *@mymedia.cf which will appear in your hotmail or gmail account.