<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>系统运维 &#187; Nginx日志</title>
	<atom:link href="http://www.osyunwei.com/archives/tag/nginx%e6%97%a5%e5%bf%97/feed" rel="self" type="application/rss+xml" />
	<link>https://www.osyunwei.com</link>
	<description>国产化OS/AnolisOS/openEuler/RHEL/CentOS/Rocky Linux/Debian/Ubuntu Linux FreeBSD 服务器教程 &#124; Windows Server 2003/2008/2012/2016/2019/2022/2025服务器教程</description>
	<lastBuildDate>Tue, 14 Apr 2026 10:59:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux下定时切割Nginx访问日志并删除指定天数前的日志记录</title>
		<link>https://www.osyunwei.com/archives/7250.html</link>
		<comments>https://www.osyunwei.com/archives/7250.html#comments</comments>
		<pubDate>Mon, 27 Jan 2014 03:15:27 +0000</pubDate>
		<dc:creator>qihang01</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx日志]]></category>

		<guid isPermaLink="false">http://www.osyunwei.com/?p=7250</guid>
		<description><![CDATA[说明： 操作系统：CentOS 站点1：bbs.osyunwei.com 站点2：sns.osyunwei.com Nginx安装路径：/usr/local/nginx Nginx配置文件路径：/usr/local/nginx/conf/nginx.conf 站点1配置文件路径：/usr/local/nginx/conf/vhost/bbs.osyunwei.com.conf 站点2配置文件路径：/usr/local/nginx/conf/vhost/sns.osyunwei.com.conf 目的： 1、对站点1和站点2的nginx访问日志按天保存,日志路径为： 站点1：/usr/local/nginx/logs/nginx_logs/bbs_logs 站点2：/usr/local/nginx/logs/nginx_logs/sns_logs 2、只保留30天以内的日志记录 具体操作： 1、创建日志存放路径 mkdir -p  /usr/local/nginx/logs/nginx_logs/bbs_logs mkdir -p  /usr/local/nginx/logs/nginx_logs/sns_logs 2、设置Nginx日志记录格式 vi /usr/local/nginx/conf/nginx.conf  #编辑 log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 取消日志记录格式前面的注释，在最后添加一行，如下所示： log_format  main  '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' '$http_host [...]<p><a rel="bookmark" href="https://www.osyunwei.com/archives/7250.html" target="_blank">查看全文</a></p>]]></description>
		<wfw:commentRss>https://www.osyunwei.com/archives/7250.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
