<?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>建站知识 &#8211; 科技改变生活-雨落星辰</title>
	<atom:link href="https://p1e.cn/collection/webserver/feed" rel="self" type="application/rss+xml" />
	<link>https://p1e.cn</link>
	<description>所有的伟大,都源于一个勇敢的开始</description>
	<lastBuildDate>Wed, 18 Dec 2024 01:41:22 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>wordpress使用PHP8.1频繁出现502问题</title>
		<link>https://p1e.cn/html/3409.html</link>
					<comments>https://p1e.cn/html/3409.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Wed, 18 Dec 2024 01:41:22 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://p1e.cn/?p=3409</guid>

					<description><![CDATA[Opcache JIT 引起的 502 问题 请注意 Opcache JIT 与 Swoole Loader 存在不兼容，若要同时使用 swoole_loader 和 opcache 时必须要修改 php.ini 关闭 opcache.jit 在PHP配置文件里设置opcache.jit=0]]></description>
										<content:encoded><![CDATA[<p>Opcache JIT 引起的 502 问题<br />
请注意 Opcache JIT 与 Swoole Loader 存在不兼容，若要同时使用 swoole_loader 和 opcache 时必须要修改 php.ini 关闭 opcache.jit<br />
在PHP配置文件里设置opcache.jit=0</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1952" src="https://i.p1e.cn/2024/12/yuchen202412180939352024121801393560.png" alt="" width="801" height="540" /></p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3409.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nginx服务器接入百度云加速CDN后如何获取真实访客IP？</title>
		<link>https://p1e.cn/html/3400.html</link>
					<comments>https://p1e.cn/html/3400.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Wed, 22 Mar 2023 09:17:39 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[百度CDN]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3400</guid>

					<description><![CDATA[默认情况下，开启百度云加速CDN后，网站日志的请求IP只会显示 百度CDN的代理节点。 但有些站长是需要查看访客真实IP，所以今天教大家如何获取真实用户IP。 百度云加速转发的HTTP头信息中增加 X-Forwarded-For 信息，用于记录客户端的真实IP，所以我们只要修改服务器配置就行， Nginx获取真实IP的方法: 原理:使用Nginx自带的Realip模块获取用户真实IP 修改nginx配置:http{}中添加如下: set_real_ip_from 0.0.0.0/0; real_ip_header]]></description>
										<content:encoded><![CDATA[<p>默认情况下，开启<b>百度云加速</b>CDN后，网站日志的请求IP只会显示 百度CDN的代理节点。</p>
<p>但有些站长是需要查看访客真实IP，所以今天教大家如何获取真实用户IP。</p>
<p>百度云加速转发的HTTP头信息中增加 X-Forwarded-For 信息，用于记录客户端的真实IP，所以我们只要修改服务器配置就行，</p>
<p><b>Nginx</b>获取真实IP的方法:<br />
原理:使用Nginx自带的Realip模块获取用户真实IP<br />
修改nginx配置:http{}中添加如下:</p>
<pre>
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For; 
</pre>
<figure class="wp-block-image size-full"><img decoding="async" class="lazy entered loaded alignnone size-full wp-image-3401" title="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图" src="https://i.p1e.cn/2023/03/blog20230322171618h2dQM6.jpg" alt="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图" width="535" height="302" /></figure>
<p>然生重载 Nginx 配置完成！</p>
<figure class="wp-block-image size-full"><img decoding="async" class="lazy entered loaded alignnone size-full wp-image-3402" title="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图1" src="https://i.p1e.cn/2023/03/blog202303221716213L7Sey.png" alt="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图1" width="1010" height="833" /></figure>
<p>测试访问网站后，查看日志，已显示真实IP，就是这么简单！</p>
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" class="lazy entered loaded alignnone size-full wp-image-3403" title="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图2" src="https://i.p1e.cn/2023/03/blog20230322171624ZGTLUs.png" alt="Nginx服务器接入百度云加速CDN后如何获取真实访客IP？插图2" width="821" height="363" /></figure>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3400.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>nginx反向代理时上传卡死或速度慢的解决办法</title>
		<link>https://p1e.cn/html/3396.html</link>
					<comments>https://p1e.cn/html/3396.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 04:27:39 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[反代]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3396</guid>

					<description><![CDATA[1.打开宝塔控制面板，选择“网站”，选择左侧“反向代理”，点击“配置文件”。 2.在location{}内添加箭头所指的一行代码：client_max_body_size 1024m;]]></description>
										<content:encoded><![CDATA[<p>1.打开宝塔控制面板，选择“网站”，选择左侧“反向代理”，点击“配置文件”。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3397" src="https://i.p1e.cn/2023/03/blog202303141225052023031404250593.png" alt="" width="944" height="695" /></p>
<p>2.在location{}内添加箭头所指的一行代码：<code>client_max_body_size 1024m;</code></p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3398" src="https://i.p1e.cn/2023/03/blog202303141227152023031404271530.png" alt="" width="657" height="479" /></p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3396.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>宝塔面板报错&#8217;latin-1&#8242; codec can&#8217;t encode characters in position 0-4: ordinal not in range(256)</title>
		<link>https://p1e.cn/html/3387.html</link>
					<comments>https://p1e.cn/html/3387.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Tue, 14 Mar 2023 01:19:52 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[宝塔]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3387</guid>

					<description><![CDATA[使用自动备份任务提示错误 &#8216;latin-1&#8217; codec can&#8217;t encode characters in position 0-4: ordinal not in range(256) 或者使用面板命令BT提示错误 Traceback (most recent call last): File &#8220;/www/server/panel/tools.py&#8221;, line 688, in &#60;module&#62; bt_cli(clinum) File &]]></description>
										<content:encoded><![CDATA[<p>使用自动备份任务提示错误</p>
<blockquote><p>&#8216;latin-1&#8217; codec can&#8217;t encode characters in position 0-4: ordinal not in range(256)</p></blockquote>
<p>或者使用面板命令BT提示错误</p>
<blockquote><p>Traceback (most recent call last):<br />
File &#8220;/www/server/panel/tools.py&#8221;, line 688, in &lt;module&gt;<br />
bt_cli(clinum)<br />
File &#8220;/www/server/panel/tools.py&#8221;, line 431, in bt_cli<br />
print(&#8220;===============\u5b9d\u5854\u9762\u677f\u547d\u4ee4\u884c==================&#8221;)<br />
UnicodeEncodeError: &#8216;latin-1&#8217; codec can&#8217;t encode characters in position 15-21: ordinal not in range(256)</p></blockquote>
<p>这都是字符问题引起的错误，参考以下文章设置即可解决</p>
<div class="insert-post b2-radius post">
        <span class="insert-post-bg">
        <picture class="picture" ><source type="image/webp" data-srcset="https://i.p1e.cn/2019/05/1558765532-baota.jpg" srcset="https://p1e.cn/wp-content/themes/b2/Assets/fontend/images/default-img.jpg" /><img decoding="async"  class="b2-radius lazy" data-src="https://i.p1e.cn/2019/05/1558765532-baota.jpg"   alt="" src="https://p1e.cn/wp-content/themes/b2/Assets/fontend/images/default-img.jpg"/></picture>
        </span><div class="insert-post-thumb">
            <a href="https://p1e.cn/html/3252.html" target="_blank">
            <picture class="picture" ><source type="image/webp" data-srcset="https://i.p1e.cn/2019/05/1558765532-baota.jpg" srcset="https://p1e.cn/wp-content/themes/b2/Assets/fontend/images/default-img.jpg" /><img decoding="async"  class="b2-radius lazy" data-src="https://i.p1e.cn/2019/05/1558765532-baota.jpg"   alt="" src="https://p1e.cn/wp-content/themes/b2/Assets/fontend/images/default-img.jpg"/></picture>
            </a>
        </div><a href="https://p1e.cn/html/3252.html" class="mp-hidden" data-type="post" data-id="3252"></a><a href="javascript:void(0)" class="mp-show" data-type="post" data-id="3252"></a><div class="insert-post-content">
                <h2><a href="https://p1e.cn/html/3252.html" target="_blank">彻底解决宝塔面板登录后台中文乱码</a></h2>
                <div class="insert-post-meta">
                    <div class="insert-post-meta-avatar mp-hidden-all"><img decoding="async" class="avatar" src="https://thirdqq.qlogo.cn/g?b=oidb&k=cszqShMOzalViaj3ibeqfjEg&s=100" /><a href="https://p1e.cn/users/auuAwtzuk">Naoki</a></div>
                    <ul class="post-meta">
                        <li class="single-date">
                            <time class="b2timeago" datetime="2022-12-13 15:04:06" itemprop="datePublished">22年12月13日</time>
                        </li>
                        <li class="single-like">
                            <i class="b2font b2-heart-fill "></i><span class="mp-show">喜欢：</span>0
                        </li>
                        <li class="single-eye">
                            <i class="b2font b2-eye-fill "></i><span class="mp-show">浏览：</span>702
                        </li>
                    </ul>
                </div>
            </div></div>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3387.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian11怎么查看虚拟内存使用情况? 查看进程占用虚拟内存技巧</title>
		<link>https://p1e.cn/html/3346.html</link>
					<comments>https://p1e.cn/html/3346.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Fri, 17 Feb 2023 04:10:27 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[debian11]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3346</guid>

					<description><![CDATA[Debian11如何查看进程占用虚拟内存？查看虚拟内存的情况，该怎么查看呢？下面我们就来看看详细的教程。 方法一、 打开终端，输入top，按回车键执行命令，top命令执行结果，【VIRT】一栏即为进程占用的虚拟内存大小。 方法二、 点【附件】-【任务管理器】。 点下拉按钮。 勾选【虚拟占用内存】。 以上就是Debian11查看进程占用虚拟内存技巧，希望大家喜欢，请继续关注雨落星辰。]]></description>
										<content:encoded><![CDATA[<p>Debian11如何查看进程占用虚拟内存？查看虚拟内存的情况，该怎么查看呢？下面我们就来看看详细的教程。</p>
<h3>方法一、</h3>
<p>打开终端，输入top，按回车键执行命令，<strong>top命令执行结果，【</strong><strong>VIRT</strong>】一栏即为进程占用的虚拟内存大小。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3347" src="https://i.p1e.cn/2023/02/blog20230217120926dhl19V.jpg" width="800" height="527" /></p>
<h3>方法二、</h3>
<p>点【附件】-【<strong>任务管理器</strong>】。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3348" src="https://i.p1e.cn/2023/02/blog20230217120929yl4nGe.jpg" width="778" height="715" /></p>
<p>点下拉按钮。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3349" src="https://i.p1e.cn/2023/02/blog20230217120932FNPtQn.jpg" width="1131" height="685" /></p>
<p>勾选【<strong>虚拟占用内存</strong>】。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3350" src="https://i.p1e.cn/2023/02/blog20230217120934KFHbS1.jpg" width="1144" height="704" /></p>
<p>以上就是Debian11查看进程占用虚拟内存技巧，希望大家喜欢，请继续关注雨落星辰。</p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3346.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian11从网络授时并修改硬件时间</title>
		<link>https://p1e.cn/html/3285.html</link>
					<comments>https://p1e.cn/html/3285.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Wed, 01 Feb 2023 00:36:00 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[debian11]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3285</guid>

					<description><![CDATA[1.首先安装必要的软件 apt update apt install ntpdate 2.使用ntpdate 命令进行系统授时 ntpdate -u ntp.ntsc.ac.cn 3. 使用 hwclock 命令修改主板时间 hwclock -w #注意，参数 -s 是根据主板时间修改系统时间]]></description>
										<content:encoded><![CDATA[<p>1.首先安装必要的软件</p>
<pre>
apt update
apt install ntpdate
</pre>
<p>2.使用ntpdate 命令进行系统授时</p>
<pre>
ntpdate -u ntp.ntsc.ac.cn
</pre>
<p>3. 使用 hwclock 命令修改主板时间</p>
<pre>
hwclock -w
#注意，参数 -s 是根据主板时间修改系统时间
</pre>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3285.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CentOS安装Apache Bench进行网站压力测试</title>
		<link>https://p1e.cn/html/3276.html</link>
					<comments>https://p1e.cn/html/3276.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Sun, 29 Jan 2023 04:05:00 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[Apache Bench]]></category>
		<category><![CDATA[Centos]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3276</guid>

					<description><![CDATA[ApacheBench （简称ab）是一个指令列程式，可用于网站压力测试。如果已经安装过Apache，会自带ab工具，如果不想安装Apache，又想使用ab命令的可通过下面的方法单独安装ApacheBench 安装 #安装相关依赖 yum -y install apr-util yum -y install yum-utils #创建临时目录 mkdir abtmp &#38;&#38; cd abtmp #安装 yumdownloader httpd-tools* rpm2cpio httpd-tools-*.r]]></description>
										<content:encoded><![CDATA[<p>ApacheBench （简称ab）是一个指令列程式，可用于网站压力测试。如果已经安装过Apache，会自带ab工具，如果不想安装Apache，又想使用ab命令的可通过下面的方法单独安装ApacheBench</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3277" src="https://i.p1e.cn/2023/01/blog20230129120323pEAajY.jpg" width="500" height="203" /></p>
<h3>安装</h3>
<pre><code class="bash hljs"><span class="hljs-comment">#安装相关依赖</span>
yum -y install apr-util
yum -y install yum-utils
<span class="hljs-comment">#创建临时目录</span>
mkdir abtmp &amp;&amp; <span class="hljs-built_in">cd</span> abtmp
<span class="hljs-comment">#安装</span>
yumdownloader httpd-tools*
rpm2cpio httpd-tools-*.rpm |cpio -idmv
<span class="hljs-comment">#拷贝</span>
cp usr/bin/ab /usr/bin
</code></pre>
<p>输入上面的命令，一行一个，不出意外的情况下输入<code>ab -V</code>就能查看到相关信息了，如下截图。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3278" src="https://i.p1e.cn/2023/01/blog20230129120326auf742.png" width="526" height="69" /></p>
<h3>网站压力测试</h3>
<p>输入命令<code>ab -n 1000 -c 50 https://www.baidu.com/</code>进行测试，这句话的意思是对www.baidu.com发起1000个请求，并发数为50，常用的参数基本就下面两个：</p>
<ul>
<li>-n：指定测试会话使用的请求数；</li>
<li>-c：指定一次向服务器发出请求数；</li>
</ul>
<p>如果需要查看更多的参数说明，请访问：<a title="ab命令" href="http://man.linuxde.net/ab" target="_blank" rel="nofollow noopener">ab命令</a><br />
通过日志分析，发现刚刚ab命令发送了大量请求过来，如下截图，相当于网站正在遭受小规模的CC攻击。</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3279" src="https://i.p1e.cn/2023/01/blog20230129120328KAtAf7.png" width="584" height="457" /></p>
<h3>总结</h3>
<p>ApacheBench可用户网站压力测试，亦可用于发起CC攻击，请不要滥用哦。</p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3276.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>网站加载 Waiting (TTFB) 时间过长的原因和解决办法</title>
		<link>https://p1e.cn/html/3272.html</link>
					<comments>https://p1e.cn/html/3272.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Sun, 29 Jan 2023 03:52:48 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[TTFB]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3272</guid>

					<description><![CDATA[关注网页前端性能的朋友，在优化网页性能的时候都会遇到网站加载 Waiting（TTFB）时间过长的问题。对于没有优化过的 WordPress 站点，TTFB 时间经常超过了页面内容的下载时间，为用户带来不必要的等待时间。这个问题的主要原因是在服务器端，不熟悉服务器运维的朋友优化起来可能会不知道从哪里下手，今天我们就从各方面分析一下网站加载 Waiting (TTFB) 时间过长的原因和解决办法。 什么是 Waiting (TTFB) 时间 TTFB 是 Time to First Byte 的缩写，指的是浏览器开始]]></description>
										<content:encoded><![CDATA[<p>关注网页前端性能的朋友，在优化网页性能的时候都会遇到网站加载 <strong>Waiting（TTFB）时间过长</strong>的问题。对于没有优化过的 WordPress 站点，TTFB 时间经常超过了页面内容的下载时间，为用户带来不必要的等待时间。这个问题的主要原因是在服务器端，不熟悉服务器运维的朋友优化起来可能会不知道从哪里下手，今天我们就从各方面分析一下网站加载 Waiting (TTFB) 时间过长的原因和解决办法。</p>
<h2 id="shen-me-shi-Waiting-TTFB-shi-jian">什么是 Waiting (TTFB) 时间</h2>
<p>TTFB 是 Time to First Byte 的缩写，指的是浏览器开始收到服务器响应数据的时间（后台处理时间+重定向时间），是反映服务端响应速度的重要指标。就像你问朋友了一个问题，你的朋友思考了一会儿才给你答案，你朋友思考的时间就相当于 TTFB。你朋友思考的时间越短，就说明你朋友越聪明或者对你的问题越熟悉。对服务器来说，TTFB 时间越短，就说明服务器响应越快。</p>
<h2 id="TTFB-shi-jian-duo-zhang-suan-zhang">TTFB 时间多长算长？</h2>
<p>因为每个服务器的硬件和网络环境都不尽相同，每个服务器的 TTFB 时间也不相同。如果想知道你的服务器优化可以到什么程度，大家可以上传一些静态的 HTML 页面到服务器，然后打开这些静态页面，看一些这些页面的 TTFB 时间，大多数服务器的 TTFB 时间都在 50 ms 以下，这个时间就是我们优化时候可以追求的时间。下面两个图中的 TTFB 时间分别是本站所在服务器的静态和动态网页 TTFB 等待时间。</p>
<figure class="wp-block-image alignnone wp-image-4683 size-full"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3273" src="https://i.p1e.cn/2023/01/blog20230129113535bahFiu.png" alt="静态网页 waiting （ttfb）时间" width="857" height="336" /><figcaption>静态网页 Waiting （TTFB）时间</figcaption></figure>
<figure class="wp-block-image alignnone wp-image-4684 size-full"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3274" src="https://i.p1e.cn/2023/01/blog2023012911353721IIVK.png" alt="动态网页 waiting （ttfb）时间" width="860" height="336" /><figcaption>动态网页 Waiting （TTFB）时间</figcaption></figure>
<p>根据我们的测试，TTFB 时间如果超过了 500 ms，用户在打开网页的时候就会感觉到明显的等待。我么可以把 500 ms 以上认为是 TTFB 时间过长。可见，WordPress 智库的服务器还不算差。</p>
<h2 id="TTFB-guo-chang-de-yuan-yin">TTFB 过长的原因</h2>
<p>我们知道，对于动态网页来说，服务器收到用户打开一个页面的请求时，首先要从数据库中读取该页面需要的数据，然后把这些数据传入到模版中，模版渲染后，再返回给用户。由于查询数据和渲染模版需要需要一定的时间，在这个过程没有完成之前，浏览器就一致处于等待接收服务器响应的状态。有些服务的性能比较低，或者优化没做好，这个时间就会比较长。</p>
<p>当然，如果服务器到用户之间的网络不好，（比如，服务器在欧洲，用户在中国，用户打开网页的时候，请求需要跨越千山万水才能达到服务器），服务器接收到用户请求的时间过长，也是导致 TTFB 时间过长的原因。</p>
<p>有时候，页面在用户的浏览器中保存了过多的 Cookie，每次请求，这些 Cookie 都要发送到服务器，服务器都要处理这些 Cookie，这也是导致 TTFB 时间过长的原因之一。</p>
<h2 id="Waiting-TTFB-shi-jian-guo-chang-de-jie-jue-ban-fa">Waiting (TTFB) 时间过长的解决办法</h2>
<p>知道了原因，解决办法就显而易见了，那就是缩短服务器响应时间，最简单直接并且有效的办法就是使用缓存，把 PHP 和 MySQL 的执行时间最小化，一些缓存插件可以把 SQL 查询结果缓存起来，把几十次查询结果转换为几次；一些缓存插件可以直接把用户所请求的页面静态化，用户打开网页时，相当于直接从服务器上下载了静态页面。</p>
<p>如果是网络原因，换一个服务器是比较直接的解决办法。如果因为一些原因不能换服务器，可以使用一个 CDN，把页面同步到离用户比较近的 CDN 节点上，也是一个不错的解决办法。</p>
<p>如果是 Cookie 的原因，可以通过修改应用程序，删除一些不必要的 Cookie，或者精简 Cookie 内容，缩短 Cookie 的有效期等，都是解决办法。</p>
<p>我们提供付费的网站性能优化服务，如果您想优化自己的网站速度，让客户更快的看到网站，却不方便自己动手，请通过 QQ 或电子邮件联系我们。</p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3272.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>几个常用 Nginx 规则</title>
		<link>https://p1e.cn/html/3271.html</link>
					<comments>https://p1e.cn/html/3271.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Sun, 29 Jan 2023 03:01:56 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[nginx]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3271</guid>

					<description><![CDATA[本人常用的几个 Nginx 规则，笔记笔记。 防止tpl inc cfg文件被下载 location ~* \.(tpl&#124;inc&#124;cfg)$ { deny all; } 套用CDN的情况返回真实IP add_header X-Real-IP $http_x_real_ip; set_real_ip_from 0.0.0.0/0; real_ip_header X-Real-IP; real_ip_recursive on; SSL反代 server { listen 443; server_name www.cca]]></description>
										<content:encoded><![CDATA[<p>本人常用的几个 Nginx 规则，笔记笔记。<br />
防止tpl inc cfg文件被下载</p>
<pre>location ~* \.(tpl|inc|cfg)$ { 
        deny all;
        }
</pre>
<p>套用CDN的情况返回真实IP</p>
<pre>add_header X-Real-IP $http_x_real_ip;
        set_real_ip_from 0.0.0.0/0;
        real_ip_header X-Real-IP;
        real_ip_recursive on;
</pre>
<p>SSL反代</p>
<pre>server
    {
     listen 443;
      server_name www.ccav.me ccav.me;
      #rewrite ^/(.*) https://$server_name$1 permanent;
      ssl on;
      ssl_certificate /root/#PEM/CRT;
      ssl_certificate_key /root/#KEY;
      #               ssl_protocols SSLv2 SSLv3 TLSv1;
       #              ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        #             ssl_prefer_server_ciphers on;
     #listen 80;
      location / {
      proxy_redirect www.B.com /;
      proxy_pass https://www.B.com;
      proxy_set_header Accept-Encoding "";
      proxy_set_header User-Agent $http_user_agent;
      proxy_set_header Accept-Language "zh-CN";
      proxy_set_header X-Real-IP $remote_addr;

    }
    }
 
server
    {
     listen 80;
      server_name www.815494.com 815494.com;
      rewrite ^(.*) https://$server_name$1 permanent;
    }
</pre>
<p>根据指定来访IP跳转</p>
<pre>if ($remote_addr ~* "192.168.1.2|192.168.1.3|103.118.40.232192.168.1.4") {
rewrite ^/(.*) https://815494.com;
}
</pre>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3271.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Chrome 您的连接不是私密连接解决办法</title>
		<link>https://p1e.cn/html/3265.html</link>
					<comments>https://p1e.cn/html/3265.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Tue, 17 Jan 2023 06:10:21 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[chrome]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3265</guid>

					<description><![CDATA[问题 最近chrome版本移除了关于ssl配置错误后，点高级没有继续访问的选项。 提示如下： 您的连接不是私密连接 攻击者可能会试图从 x.x.x.x 窃取您的信息（例如：密码、通讯内容或信用卡信息）。了解详情 NET::ERR_CERT_INVALID 将您访问的部分网页的网址、有限的系统信息以及部分网页内容发送给 Google，以帮助我们提升 Chrome 的安全性。隐私权政策 x.x.x.x 通常会使用加密技术来保护您的信息。Google Chrome 此次尝试连接到 x.x.x.x 时，此网站发回了异常的错]]></description>
										<content:encoded><![CDATA[<p><b>问题</b><br />
最近chrome版本移除了关于ssl配置错误后，点高级没有继续访问的选项。<br />
提示如下：<br />
您的连接不是私密连接<br />
攻击者可能会试图从 x.x.x.x 窃取您的信息（例如：密码、通讯内容或信用卡信息）。了解详情<br />
NET::ERR_CERT_INVALID<br />
将您访问的部分网页的网址、有限的系统信息以及部分网页内容发送给 Google，以帮助我们提升 Chrome 的安全性。隐私权政策<br />
x.x.x.x 通常会使用加密技术来保护您的信息。Google Chrome 此次尝试连接到 x.x.x.x 时，此网站发回了异常的错误凭据。这可能是因为有攻击者在试图冒充 x.x.x.x，或 Wi-Fi 登录屏幕中断了此次连接。请放心，您的信息仍然是安全的，因为 Google Chrome 尚未进行任何数据交换便停止了连接。<br />
您目前无法访问 x.x.x.x，因为此网站发送了 Google Chrome 无法处理的杂乱凭据。网络错误和攻击通常是暂时的，因此，此网页稍后可能会恢复正常。</p>
<p><b>解决办法</b><br />
解决办法就是在当前页面用键盘输入 <code><strong>thisisunsafe</strong></code> ，不是在地址栏输入，就直接敲键盘就行了，页面即会自动刷新进入网页。</p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3265.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
