


Nginx common log splitting methods nginx apache nginx php nginx rewrite
方式一: nginx cronolog日志分割配置文档,根据下面方法,每分钟分割一次NGINX访问日志。 <span>1</span>.nginx日志配置 access_log access_log /data/access_log_pipe main; <span>2</span>.先创建一个命名管道 mkfifo /www/<span>log</span>/access_log_pipe <span>3</span>.配置cronolog: nohup cat /data/access_log_pipe | <span>/usr/local</span><span>/sbin/cronolog</span> /data/<span>log</span>/domain.access<span>_</span><span>%Y</span><span>%m</span><span>%d</span><span>%H</span><span>%M</span>.<span>log</span> & <span>4</span>.启动Nginx /usr/<span>local</span>/nginx/sbin/nginx 注意: cronolog必须在nginx启动前启动 没有安装cronolog的话,需要先安装 wget http:<span>//cronolog</span>.org/download/cronolog-<span>1.6</span>.<span>2</span>.tar.gz tar zxvf cronolog-<span>1.6</span>.<span>2</span>.tar.gz cd cronolog-<span>1.6</span>.<span>2</span> .<span>/configure make make install 方式二: 定时任务中每小时添加定时任务,执行一下脚本,可以实现小时日志分割 log_dir="/var</span><span>/log/nginx</span><span>" date_dir=`date +<span>%Y</span>/<span>%m</span>/<span>%d</span>/<span>%H</span>` /bin/mkdir -p <span>${log_dir}</span>/<span>${date_dir}</span> > /dev/null 2>&1 /bin/mv <span>${log_dir}</span>/access.log <span>${log_dir}</span>/<span>${date_dir}</span>/access.log kill -USR1 `cat /opt/nginx/logs/nginx.pid` 方式三: 使用logrotate做nginx日志轮询 logrotate看名字就知道是专门做日志轮询的,只把任务配置放在/etc/logrotate.d/下,任务就会自动完成,而且无需安装,系统自带,比较推荐使用. vi /etc/logrotate.d/nginx /usr/local/nginx/logs/www.willko.cn.log /usr/local/nginx/logs/nginx_error.log { notifempty daily sharedscripts postrotate /bin/kill -USR1 `/bin/cat /usr/local/nginx/nginx.pid` endscript } 多个日志以空格分开, notifempty 如果日志为空则不做轮询 daily 每天执行一次 postrotate 日志轮询后执行的脚本 这样,每天都会自动轮询,生成nginx.log.1-n 后话: 用Jmeter对方法一进行了测试,新建线程组:线程数200,循环150,新建http请求,请求nginx上的图片,请求30000次,失败326次,后台形成5个文件,行数如下: 2868 access_201112182030.log 7777 access_201112182031.log 7626 access_201112182032.log 7873 access_201112182033.log 3530 access_201112182034.log 29674 total 并没有因为切分文件而丢失日志。</span>
The above introduces the common log splitting methods of Nginx, including nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools