<?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>Nginx Monitor (监控) &#8211; Eternal Center</title>
	<atom:link href="https://eternalcenter-sep-2022.github.io/category/service/website-service/nginx/nginx-monitor/feed/" rel="self" type="application/rss+xml" />
	<link>https://eternalcenter-sep-2022.github.io/</link>
	<description></description>
	<lastBuildDate>Mon, 29 Aug 2022 08:04:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>[工具] Shell LNMP 没运行则重启系统 （systemctl 版）</title>
		<link>https://eternalcenter-sep-2022.github.io/shell-lnmp-check-restart-systemctl/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 10 Dec 2021 14:26:19 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Language (语言)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Monitor (监控)]]></category>
		<category><![CDATA[Shell Tools (工具)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=19607</guid>

					<description><![CDATA[介绍 基本信息 作者：朱明宇名称：LNMP 没运行则重启系统作用：LNMP 没运行则重启系统 使用方法 1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本]]></description>
										<content:encoded><![CDATA[
<h2>介绍</h2>



<h3>基本信息</h3>



<p>作者：朱明宇<br>名称：LNMP 没运行则重启系统<br>作用：LNMP 没运行则重启系统</p>



<h3>使用方法</h3>



<p>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<h2>脚本</h2>



<pre class="wp-block-code"><code>#!/bin/bash
  
systemctl status nginx | grep 'active (running)'
if &#91; $? -ne 0 ];then
        /usr/sbin/reboot
fi

systemctl status mariadb | grep 'active (running)'
if &#91; $? -ne 0 ];then
        /usr/sbin/reboot
fi

systemctl status php-fpm | grep 'active (running)'
if &#91; $? -ne 0 ];then
        /usr/sbin/reboot
fi</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 命令 curl （测试网页访问）</title>
		<link>https://eternalcenter-sep-2022.github.io/curl/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Wed, 28 Jul 2021 08:00:30 +0000</pubDate>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Django Service (服务)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=17159</guid>

					<description><![CDATA[内容一：测试网页可以被访问的案例 （补充：这里以直接访问 https://eternalcenter-sep-2022.github.io/ 网页为例） 内容二：测试网页访问速度的案例 2.1 案例一：显示测试过程 （补充：这里以访问并测试 https://eternalcenter-sep-2022.github.io，并显示测试过程为例）/ 2.2 案例二：不显示测试过程 （补充：这里以访问并测试 https://eternalcenter-sep-2022.github.io，并不显示测试过程为例）/ 内容三：测试使用代理访问网页的案例 3.1 案例一：使用代理 （补充：这里以通过 proxy.example.com:8080 代理访问 https://eternalcenter-sep-2022.github.io/ 网页为例） 3.2 案例二：使用代理并使用用户进行验证 （补充：这里以通过 proxy.example.com:8080 代理并使用 proxy user 和 password 进行验证访问 https://eternalcenter-sep-2022.github.io/ 网页为例） 内容四： 测试使用证书访问网页的案例 （补充：这里以通过 eternalcenter.com.pem 证书访问 https://eternalcenter-sep-2022.github.io/ 网页为例） 内容五：其他测试访问网页的案例 5.1 案例一：将网页下载后另存为别的文件 （补充：这里以下载 https://eternalcenter-sep-2022.github.io/ 并另存为 eternalcentre.com 为例） 5.2 案例二：静默下载的案例 （补充：这里以静默下载 https://eternalcenter-sep-2022.github.io/ 为例） 5.3 案例三：不使用安全证书访问网页 &#8230; <p class="link-more"><a href="https://eternalcenter-sep-2022.github.io/curl/" class="more-link">Continue reading<span class="screen-reader-text"> "[命令] Linux 命令 curl （测试网页访问）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h3> 内容一：测试网页可以被访问的案例 </h3>



<pre class="wp-block-code"><code># curl -v -k https://eternalcenter-sep-2022.github.io/</code></pre>



<p> （补充：这里以直接访问 https://eternalcenter-sep-2022.github.io/ 网页为例） </p>



<h3>内容二：测试网页访问速度的案例</h3>



<h4>2.1 案例一：显示测试过程</h4>



<pre class="wp-block-code"><code># curl -o /dev/null -s -w %{http_code}:%{http_connect}:%{content_type}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download} https://eternalcenter-sep-2022.github.io/</code></pre>



<p>（补充：这里以访问并测试  https://eternalcenter-sep-2022.github.io，并显示测试过程为例）/</p>



<h4>2.2 案例二：不显示测试过程</h4>



<pre class="wp-block-code"><code># curl -o /dev/null -w %{http_code}:%{http_connect}:%{content_type}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download} https://
eternalcenter.com</code></pre>



<p> （补充：这里以访问并测试   https://eternalcenter-sep-2022.github.io，并不显示测试过程为例）/ </p>



<h3>内容三：测试使用代理访问网页的案例</h3>



<h4>3.1 案例一：使用代理</h4>



<pre class="wp-block-code"><code># curl -v --proxy proxy.example.com:8080 https://eternalcenter-sep-2022.github.io/</code></pre>



<p>（补充：这里以通过 proxy.example.com:8080 代理访问 https://eternalcenter-sep-2022.github.io/ 网页为例）</p>



<h4>3.2 案例二：使用代理并使用用户进行验证</h4>



<pre class="wp-block-code"><code># curl -v --&lt;proxy user&gt; user:&lt;password&gt; --proxy proxy.example.com:8080 https://eternalcenter-sep-2022.github.io/</code></pre>



<p>（补充：这里以通过 proxy.example.com:8080 代理并使用 proxy user 和 password 进行验证访问 https://eternalcenter-sep-2022.github.io/ 网页为例）</p>



<h3>内容四： 测试使用证书访问网页的案例 </h3>



<pre class="wp-block-code"><code># curl -v -k https://eternalcenter-sep-2022.github.io/ --cacert /eternalcenter.com.pem</code></pre>



<p>（补充：这里以通过 eternalcenter.com.pem 证书访问 https://eternalcenter-sep-2022.github.io/ 网页为例）</p>



<h3>内容五：其他测试访问网页的案例</h3>



<h4>5.1 案例一：将网页下载后另存为别的文件</h4>



<pre class="wp-block-code"><code># curl -v https://eternalcenter-sep-2022.github.io/ -o eternalcentre.com</code></pre>



<p>（补充：这里以下载 https://eternalcenter-sep-2022.github.io/ 并另存为 eternalcentre.com 为例）</p>



<h4>5.2 案例二：静默下载的案例</h4>



<pre class="wp-block-code"><code># curl -v https://eternalcenter-sep-2022.github.io/ -o eternalcentre.com --silent</code></pre>



<p>（补充：这里以静默下载 https://eternalcenter-sep-2022.github.io/ 为例）</p>



<h4>5.3 案例三：不使用安全证书访问网页</h4>



<pre class="wp-block-code"><code># curl -k https://eternalcenter-sep-2022.github.io/</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># curl https://eternalcenter-sep-2022.github.io/ --insecure</code></pre>



<p>（补充：这里以不使用安全证书访问 https://eternalcenter-sep-2022.github.io/ 网页为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Linux Nginx  源码安装包的管理 （通过 systemd 实现）</title>
		<link>https://eternalcenter-sep-2022.github.io/systemctl-service/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 17 Oct 2019 14:32:11 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Management (管理)]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Process (系统进程)]]></category>
		<category><![CDATA[System Process & System Performance (系统进程 & 系统性能)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=5912</guid>

					<description><![CDATA[注意： 在通过 systemd 管理源码安装的软件或自制 rpm 包安装的软件（以 Nginx 为例）之前，先要源码安装 Nginx 或者自制 rpm 包安装 Nginx 正文： 步骤一：创建 Nginx 的 systemd 文件 创建以下内容： 步骤二：导入新创建的 Nginx systemd 配置文件 步骤三：使用 systemd 管理 Nginx 3.1 使用 systemd 启动 Nginx 3.2 使用 systemd 开机自启 Nginx 3.3 使用 systemd 显示 Nginx 的状态]]></description>
										<content:encoded><![CDATA[
<h1>注意：</h1>



<p>在通过 systemd 管理源码安装的软件或自制 rpm 包安装的软件（以 Nginx 为例）之前，先要源码安装 Nginx 或者自制 rpm 包安装 Nginx</p>



<div class="wp-container-1 is-horizontal is-content-justification-center wp-block-buttons">
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link no-border-radius" href="https://eternalcenter-sep-2022.github.io/nginx-install-source/">Nginx 源码软件包的安装</a></div>



<div class="wp-block-button is-style-outline"><a class="wp-block-button__link no-border-radius" href="https://eternalcenter-sep-2022.github.io/rpm-make/">Linux rpm 软件包的制作<br>（通过 rpm-build 实现）<br>（Nginx 版）</a></div>
</div>



<h1 id="正文">正文：</h1>



<h3 id="步骤一-创建-nginx-的-systemd-文件">步骤一：创建 Nginx 的 systemd 文件</h3>



<pre class="wp-block-code"><code># vim /etc/systemd/system/nginx.service </code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code>&#91;Unit]

Description=nginx server daemon

Documentation=man:nginx(8)

After=network.target

&#91;Service]

Type=forking

ExecStart=/usr/local/nginx/sbin/nginx

ExecReload=/usr/local/nginx/sbin/nginx -s reload

ExecStop=/usr/local/nginx/sbin/nginx -s stop

PrivateTmp=true

&#91;Install]

WantedBy=multi-user.target</code></pre>



<h3 id="步骤二-导入新创建的-nginx-systemd-配置文件">步骤二：导入新创建的 Nginx systemd 配置文件</h3>



<pre class="wp-block-code"><code># systemctl daemon-reload</code></pre>



<h3 id="步骤三-使用-systemd-管理-ngixn3-1-使用-systemd-启动-nginx">步骤三：使用 systemd 管理 Nginx</h3>



<h4 id="步骤三-使用-systemd-管理-ngixn3-1-使用-systemd-启动-nginx">3.1 使用 systemd 启动 Nginx</h4>



<pre class="wp-block-code"><code># systemctl start nginx.service</code></pre>



<h4 id="3-2-使用-systemd-开机自启-nginx">3.2 使用 systemd 开机自启 Nginx</h4>



<pre class="wp-block-code"><code># systemctl enable nginx.service</code></pre>



<h4 id="3-3-使用-systemd-显示-nginx-的状态">3.3 使用 systemd 显示 Nginx 的状态</h4>



<pre class="wp-block-code"><code># systemctl status nginx.service</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Nginx 日志的切割</title>
		<link>https://eternalcenter-sep-2022.github.io/nginx-log-cut/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 06 Sep 2019 11:15:07 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Management (管理)]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=5733</guid>

					<description><![CDATA[注意： 在设置 Nginx 自动化日志切割并保存之前要先安装 Nginx 正文： 内容一：切割 Nginx 日志的原理 内容二：切割 Nginx 日志的 Shell 脚本 创建以下内容： 内容三：设置 Nginx 日志切割的自动化任务 （补充：这里以每周五的 3 点 3 分执行 /usr/local/nginx/nginxlog.sh 命令为例）]]></description>
										<content:encoded><![CDATA[
<h1>注意：</h1>



<p>在设置 Nginx 自动化日志切割并保存之前要先安装 Nginx</p>



<div class="wp-container-2 is-horizontal is-content-justification-center wp-block-buttons">
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link no-border-radius" href="https://eternalcenter-sep-2022.github.io/nginx-install-source/">Nginx 源码软件包的安装</a></div>
</div>



<h1>正文：</h1>



<h3>内容一：切割 Nginx 日志的原理</h3>



<pre class="wp-block-code"><code># mv access.log access2.log
# kill -USR1 $(cat /usr/local/nginx/logs/nginx.pid)</code></pre>



<h3>内容二：切割 Nginx 日志的 Shell 脚本</h3>



<pre class="wp-block-code"><code># mkdir -p /usr/local/nginx/
# vim /usr/local/nginx/nginxlog.sh</code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code>#!/bin/bash
date=$(date +%Y%m%d)
logpath=/usr/local/nginx/logs
mv $logpath/access.log $logpath/access-$date.log
mv $logpath/error.log   $logpath/error-$date.log
kill -USR1 $(cat $logpath/nginx.pid)</code></pre>



<h3>内容三：设置 Nginx 日志切割的自动化任务</h3>



<pre class="wp-block-code"><code># crontab -e
03 03 * * 5 /usr/local/nginx/nginxlog.sh</code></pre>



<p>（补充：这里以每周五的 3 点 3 分执行 /usr/local/nginx/nginxlog.sh 命令为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[实验] Nginx 模块的设置 （监控模块）</title>
		<link>https://eternalcenter-sep-2022.github.io/nginx-status/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 06 Sep 2019 11:09:36 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=5730</guid>

					<description><![CDATA[软件准备： 在 Nginx 官网上下载搭建集群所需软件 Nginx： http://nginx.org/en/download.html 正文： 步骤一：系统环境要求 1) 所有服务器的系统都需要是 CentOS 7 版本2) 所有服务器系统都需要有 yum 源 步骤二：安装带有状态信息监控模块的 Nginx （补充：这里以安装 nginx-1.16.1 为例） 步骤三：修改 Nginx 的配置文件 将部分内容修改如下： 步骤四：启动 Nginx 步骤五：显示监控模块 通过浏览器访问以下网址：]]></description>
										<content:encoded><![CDATA[
<h1>软件准备：</h1>



<p>在 Nginx 官网上下载搭建集群所需软件 Nginx：</p>



<p class="has-text-align-center"><a href="http://nginx.org/en/download.html" target="_blank" rel="noreferrer noopener">http://nginx.org/en/download.html</a></p>



<h1 id="正文">正文：</h1>



<h3 id="步骤一-系统环境要求">步骤一：系统环境要求</h3>



<p>1) 所有服务器的系统都需要是 CentOS 7 版本<br>2) 所有服务器系统都需要有 yum 源</p>



<h3 id="步骤二-安装带有状态信息监控模块的-nginx">步骤二：安装带有状态信息监控模块的 Nginx</h3>



<pre class="wp-block-code"><code># yum -y install gcc pcre-devel openssl-devel
# tar -xvf nginx-1.16.1.tar.gz
# cd nginx-1.16.1
# ./configure \
&gt;--with-http_stub_status_module
# make &amp;&amp; make install</code></pre>



<p>（补充：这里以安装 nginx-1.16.1 为例）</p>



<h3 id="步骤三-修改-nginx-的配置文件">步骤三：修改 Nginx 的配置文件</h3>



<pre class="wp-block-code"><code># vi /usr/local/nginx/conf/nginx.conf</code></pre>



<p>将部分内容修改如下：</p>



<pre class="wp-block-code"><code>......
location /status {
stub_status on;
#allow IP address；
#deny IP address；
}
......</code></pre>



<h3 id="步骤四-启动-nginx">步骤四：启动 Nginx</h3>



<pre class="wp-block-code"><code># /usr/local/nginx/bin/nginx</code></pre>



<h3 id="步骤五-显示监控模块">步骤五：显示监控模块</h3>



<p>通过浏览器访问以下网址：</p>



<pre class="wp-block-code"><code>http:&#47;&#47;127.0.0.1/status</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] LNMP 文件清单</title>
		<link>https://eternalcenter-sep-2022.github.io/lnmp-file/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 03 Sep 2019 13:27:43 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Management (管理)]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=5689</guid>

					<description><![CDATA[注意： 在管理 LNMP 文件之前先要搭建 LNMP 正文： 内容一：LNMP 平台配置文件和日志的存放目录 1.1 Nginx 的配置文件存放目录 1.2 php-fpm 的配置文件存放目录 内容二：LNMP 日志的存放目录 2.1 Nginx 的日志存放目录 2.2 Nginx 的错误日志存放目录 2.3 PHP 的错误日志存放目录]]></description>
										<content:encoded><![CDATA[
<h1>注意：</h1>



<p>在管理 LNMP 文件之前先要搭建 LNMP</p>



<div class="wp-container-3 is-horizontal is-content-justification-center wp-block-buttons">
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link no-border-radius" href="https://eternalcenter-sep-2022.github.io/shell-lnmp-install-centos-8/">Shell <br>自动化部署 LNMP + SSL 平台<br>（CentOS 8 版）</a></div>
</div>



<h1>正文：</h1>



<h3>内容一：LNMP 平台配置文件和日志的存放目录</h3>



<h4>1.1 Nginx 的配置文件存放目录</h4>



<pre class="wp-block-code"><code># ls /usr/local/nginx/conf/nginx.conf</code></pre>



<h4>1.2 php-fpm 的配置文件存放目录</h4>



<pre class="wp-block-code"><code># ls /etc/php-fpm.d/www.conf</code></pre>



<h3>内容二：LNMP 日志的存放目录</h3>



<h4>2.1 Nginx 的日志存放目录</h4>



<pre class="wp-block-code"><code># ls /usr/local/nginx/logs/access.log</code></pre>



<h4>2.2 Nginx 的错误日志存放目录</h4>



<pre class="wp-block-code"><code># ls /usr/local/nginx/logs/error.log</code></pre>



<h4>2.3 PHP 的错误日志存放目录</h4>



<pre class="wp-block-code"><code># ls /var/log/php-fpm/www-error.log</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 统计 LNMP 本月与上月的网站点击量和 IP 访问数</title>
		<link>https://eternalcenter-sep-2022.github.io/shell-lnmp-count-month/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 08 Feb 2019 13:47:11 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Language (语言)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Statistic (统计)]]></category>
		<category><![CDATA[Shell Tools (工具)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=2718</guid>

					<description><![CDATA[介绍 基本信息 作者：朱明宇名称：统计 LNMP 本月与上月的网站点击量和 IP 访问数作用：统计 LNMP 本月与上月的网站点击量和 IP 访问数 使用方法 1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本分割线里的变量 1. user=&#8221;root&#8221; #登录 Web 服务器的用户，请确保这个用户有创建缓存备份目录的权限2. ip=&#8221;8.8.8.8&#8243; #Web 服务器的 IP 地址 注意 此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器 脚本]]></description>
										<content:encoded><![CDATA[
<h2>介绍</h2>



<h3>基本信息</h3>



<p>作者：朱明宇<br>名称：统计 LNMP 本月与上月的网站点击量和 IP 访问数<br>作用：统计 LNMP 本月与上月的网站点击量和 IP 访问数</p>



<h3>使用方法</h3>



<p>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<h3>脚本分割线里的变量</h3>



<p>1. user=&#8221;root&#8221; #登录 Web 服务器的用户，请确保这个用户有创建缓存备份目录的权限<br>2. ip=&#8221;8.8.8.8&#8243; #Web 服务器的 IP 地址</p>



<h3>注意</h3>



<p>此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器</p>



<h2>脚本</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################

user="root"
ip="8.8.8.8"

####################### Separator ########################

monthcache1=$(date +%m)
case $monthcache1 in
01)
month=Jan
lmonth=Dec;;
02)
month=Feb
lmonth=Jan;;
03)
month=Mar
lmonth=Feb;;
04)
month=Apr
lmonth=Mar;;
05)
month=May
lmonth=Apr;;
06)
month=June
lmonth=May;;
07)
month=July
lmonth=June;;
08)
month=Aug
lmonth=July;;
09)
month=Sept
lmonth=Aug;;
10)
month=Oct
lmonth=Sept;;
11)
month=Nov
lmonth=Oct;;
12)
month=Dec
lmonth=Nov
esac

cmonth=`ssh $user@$ip "grep $month /usr/local/nginx/logs/access.log | wc -l"`
clmonth=`ssh $user@$ip "grep $lmonth  /usr/local/nginx/logs/access.log | wc -l"`
cipmonth=`ssh $user@$ip "grep $month /usr/local/nginx/logs/access.log" | awk '{a&#91;$1]++}END{for(i in a){print i}}' | wc -l `
ciplmonth=`ssh $user@$ip "grep $lmonth /usr/local/nginx/logs/access.log" | awk '{a&#91;$1]++}END{for(i in a){print i}}' | wc -l`

echo "The count of month's hits：$cmonth 次"
echo "The count of month's IP address：$cipmonth 个"
echo "The count of last month's hits：$clmonth 次"
echo "The count of last month's IP address：$ciplmonth 个"</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 统计 LNMP 今天与昨天的网站点击量和 IP 访问数</title>
		<link>https://eternalcenter-sep-2022.github.io/shell-lnmp-count-day/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 08 Feb 2019 13:44:42 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Language (语言)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Monitor (监控)]]></category>
		<category><![CDATA[Service (服务)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Statistic (统计)]]></category>
		<category><![CDATA[Shell Tools (工具)]]></category>
		<category><![CDATA[Website Service (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-sep-2022.github.io/?p=2716</guid>

					<description><![CDATA[介绍 基本信息 作者：朱明宇名称：统计 LNMP 今天与昨天的网站点击量和 IP 访问数作用：统计 LNMP 今天与昨天的网站点击量和 IP 访问数 使用方法 1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本分割线里的变量 1. user=&#8221;root&#8221; #登录 Web 服务器的用户，请确保这个用户有创建缓存备份目录的权限2. ip=&#8221;8.8.8.8&#8243; #Web 服务器的 IP 注意 此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器 脚本]]></description>
										<content:encoded><![CDATA[
<h2>介绍</h2>



<h3>基本信息</h3>



<p>作者：朱明宇<br>名称：统计 LNMP 今天与昨天的网站点击量和 IP 访问数<br>作用：统计 LNMP 今天与昨天的网站点击量和 IP 访问数</p>



<h3>使用方法</h3>



<p>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<h3>脚本分割线里的变量</h3>



<p>1. user=&#8221;root&#8221; #登录 Web 服务器的用户，请确保这个用户有创建缓存备份目录的权限<br>2. ip=&#8221;8.8.8.8&#8243; #Web 服务器的 IP</p>



<h3>注意</h3>



<p>此脚本执行前必须要先保证执行脚本的主机能无秘钥远程这台 Web 服务器</p>



<h2>脚本</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################

user="root"
ip="8.8.8.8"

####################### Separator ########################

tday=`date +%d`

sys=`uname -a | awk '{print $1}'`

if &#91; $sys == 'Linux' ];then
        yday=`date +%d -d "-1 day"`
else
        yday=`date -v-1d +%d`
fi

cday=`ssh $user@$ip "grep $tday/$month  /usr/local/nginx/logs/access.log | wc -l"`
cyday=`ssh $user@$ip "grep $yday/$month  /usr/local/nginx/logs/access.log | wc -l"`
cipday=`ssh $user@$ip "grep $tday/$month  /usr/local/nginx/logs/access.log" |awk '{a&#91;$1]++}END{for(i in a){print i}}' | wc -l`
cipyday=`ssh $user@$ip "grep $yday/$month  /usr/local/nginx/logs/access.log" |awk '{a&#91;$1]++}END{for(i in a){print i}}' | wc -l`

echo "The count of today's hits：$cday 次"
echo "The count of today's IP address：$cipday 个"
echo "The count of yesterday's hits：$cyday 次"
echo "The count of yesterday's IP address：$cipyday 个"</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
