<?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; NFZX</title>
	<atom:link href="https://www.nfzx.org.cn/category/jyfx/fwqyw/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nfzx.org.cn</link>
	<description>我的建筑图像日志</description>
	<lastBuildDate>Fri, 13 Mar 2026 14:11:35 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.nfzx.org.cn/wp-content/uploads/2022/03/cropped-20220322娃娃3-scaled-1-32x32.jpg</url>
	<title>服务器运维 &#8211; NFZX</title>
	<link>https://www.nfzx.org.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Ubuntu服务器网络优化备忘录</title>
		<link>https://www.nfzx.org.cn/2025-07-16/ubuntu%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%bb%9c%e4%bc%98%e5%8c%96%e5%a4%87%e5%bf%98%e5%bd%95/</link>
					<comments>https://www.nfzx.org.cn/2025-07-16/ubuntu%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%bb%9c%e4%bc%98%e5%8c%96%e5%a4%87%e5%bf%98%e5%bd%95/#respond</comments>
		
		<dc:creator><![CDATA[NFZX]]></dc:creator>
		<pubDate>Wed, 16 Jul 2025 07:49:18 +0000</pubDate>
				<category><![CDATA[服务器运维]]></category>
		<category><![CDATA[经验分享]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[网络优化]]></category>
		<guid isPermaLink="false">https://www.nfzx.org.cn/?p=355</guid>

					<description><![CDATA[（以下内容不全是作者原创，仅作自用。在此感谢各位原&#8230;]]></description>
										<content:encoded><![CDATA[
<p>（以下内容不全是作者原创，仅作自用。在此感谢各位原创作者的知识结晶！）</p>



<h2 class="wp-block-heading">一、使用非标端口dns服务器</h2>



<p>可修改resolved.conf文件</p>



<pre class="wp-block-code"><code>sudo nano /etc/systemd/resolved.conf</code></pre>



<p>添加参数</p>



<pre class="wp-block-code"><code>DNS=&#91;IP]:&#91;端口]</code></pre>



<p>保存文件后输入参数</p>



<pre class="wp-block-code"><code>sudo systemctl restart systemd-resolved</code></pre>



<p>重启完成后输入参数即可查看修改是否生效</p>



<pre class="wp-block-code"><code>resolvectl status</code></pre>



<h2 class="wp-block-heading">二、调节网卡MTU</h2>



<p>案例参数</p>



<pre class="wp-block-code"><code>sudo ip link set dev eth0 mtu 1480</code></pre>



<p>此参数含义为将eth0网卡的MTU调整为1480</p>



<p>输入参数</p>



<pre class="wp-block-code"><code>ifconfig</code></pre>



<p>可直接查看对应网卡MTU是否修改成功</p>



<h2 class="wp-block-heading">三、关闭THP</h2>



<p>数据库（如 Redis、MongoDB、MySQL）、Java 应用等常因 THP 的内存整理导致性能抖动和延迟峰值。</p>



<p>在服务器环境下，许多性能调优指南建议关闭 THP 以获得更稳定的内存行为。</p>



<pre class="wp-block-code"><code>echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled</code></pre>



<pre class="wp-block-code"><code>echo never | sudo tee /sys/kernel/mm/transparent_hugepage/defrag</code></pre>



<h2 class="wp-block-heading">四、自用systcl.conf参数</h2>



<pre class="wp-block-code"><code><em># 加速队列</em><br>net.core.default_qdisc = cake<br>net.ipv4.tcp_congestion_control = bbr<br><em>#拥塞控制</em><br><em># IPV6相关设置</em><br>net.ipv6.conf.all.disable_ipv6 = 1<br>net.ipv6.conf.default.disable_ipv6 = 1<br>net.ipv6.conf.lo.disable_ipv6 = 1<br><em># 虚拟内存</em><br>vm.swappiness = 80<br>vm.vfs_cache_pressure = 70<br>vm.overcommit_memory = 1<br><em># 增加 TCP 连接队列</em><br>net.core.somaxconn = 65535   <em># 连接队列长度</em><br>net.ipv4.tcp_max_syn_backlog = 65536  <em># SYN队列大小</em><br><em># 快速回收 TIME-WAIT 连接</em><br>net.ipv4.tcp_tw_reuse = 1     <em># 快速回收TIME_WAIT连接</em><br>net.ipv4.tcp_fin_timeout = 15<br><em># 提升端口范围</em><br>net.ipv4.ip_local_port_range = 1024 65535<br><em># 增大 TLS 握手缓冲区</em><br>net.core.rmem_max = 16777216<br>net.core.wmem_max = 16777216<br>net.ipv4.tcp_rmem = 4096 87380 16777216<br>net.ipv4.tcp_wmem = 4096 65536 16777216<br><em># 启用 TCP Fast Open</em><br>net.ipv4.tcp_fastopen = 3<br><em># 提升文件句柄限制</em><br>fs.file-max = 1000000<br>fs.nr_open = 1000000<br><em># 增加 UDP 缓冲区</em><br>net.core.rmem_default = 1048576<br>net.core.wmem_default = 1048576<br>net.core.rmem_max = 16777216<br>net.core.wmem_max = 16777216<br><em># 增加中断队列长度</em><br>net.core.netdev_max_backlog = 100000<br><em># 提升软中断处理能力</em><br>net.core.netdev_budget = 600<br>net.core.netdev_budget_usecs = 8000<br><em># ECN</em><br>net.ipv4.tcp_ecn=1</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nfzx.org.cn/2025-07-16/ubuntu%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bd%91%e7%bb%9c%e4%bc%98%e5%8c%96%e5%a4%87%e5%bf%98%e5%bd%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>博客维护优化自用备忘录</title>
		<link>https://www.nfzx.org.cn/2023-08-26/%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bb%b4%e6%8a%a4%e4%bc%98%e5%8c%96%e8%87%aa%e7%94%a8%e5%a4%87%e5%bf%98%e5%bd%95/</link>
					<comments>https://www.nfzx.org.cn/2023-08-26/%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bb%b4%e6%8a%a4%e4%bc%98%e5%8c%96%e8%87%aa%e7%94%a8%e5%a4%87%e5%bf%98%e5%bd%95/#respond</comments>
		
		<dc:creator><![CDATA[NFZX]]></dc:creator>
		<pubDate>Sat, 26 Aug 2023 08:34:08 +0000</pubDate>
				<category><![CDATA[服务器运维]]></category>
		<category><![CDATA[经验分享]]></category>
		<guid isPermaLink="false">https://www.nfzx.org.cn/?p=223</guid>

					<description><![CDATA[（以下内容不全是作者原创，仅作自用。在此感谢各位原&#8230;]]></description>
										<content:encoded><![CDATA[
<p>（以下内容不全是作者原创，仅作自用。在此感谢各位原创作者的知识结晶！）</p>



<h2 class="wp-block-heading"><strong>Apache2</strong></h2>



<p>1、Apache2开启SNI功能</p>



<p>在 Ubuntu 16.04 下，OpenSSL 默认已经编译好了&nbsp;SNI 支持，所以，Apache2 开启SNI就一句话：</p>



<p>将&nbsp;<code>/etc/apache2/mods-available/ssl.conf</code>&nbsp;文件最后的&nbsp;<code>#SSLStrictSNIVHostCheck On</code>&nbsp;前的注释符号(#)去掉即可</p>



<p>别忘了重启apache 哦～</p>



<p>2、Apache2开启Event MPM及http2</p>



<p>首先，Apache2默认开启的是Prework MPM，这个模块相对稳定，但是性能相比于新模块来说逊色很多。我们先用以下命令来检验目前Apache2运用的模块：</p>



<pre class="wp-block-code"><code>apachectl -V</code></pre>



<p>查看server fpm一项显示即可看出目前正在使用的模块。</p>



<p>再用以下命令检验下PHP-fpm在系统中是否已经正常安装：</p>



<pre class="wp-block-code"><code>whereis php-fpm</code></pre>



<p>如果能成功输出安装位置代表已经正常安装。</p>



<p>如果没有安装，则输入以下命令正常安装PHP-fpm：</p>



<pre class="wp-block-code"><code>apt-get install php-fpm</code></pre>



<p>紧接着启用其它必须的模块：</p>



<pre class="wp-block-code"><code>a2enmod proxy_fcgi</code></pre>



<pre class="wp-block-code"><code>a2enmod setenvif</code></pre>



<pre class="wp-block-code"><code>a2enconf php7.4-fpm
a2enconf php8.1-fpm</code></pre>



<p>接着关闭在安装Apache2的标准PHP模块：</p>



<pre class="wp-block-code"><code>a2dismod php7.4
a2dismod php8.1</code></pre>



<p>（注：目前版本是7.4，后续版本号更新可自行替换）</p>



<p>然后是禁用Apache2旧有MPM并开启新MPM：</p>



<pre class="wp-block-code"><code>a2dismod mpm_prefork</code></pre>



<pre class="wp-block-code"><code>a2dismod mpm_worker</code></pre>



<pre class="wp-block-code"><code>a2enmod mpm_event</code></pre>



<p>紧接着是开启Apache2的http2模块：</p>



<pre class="wp-block-code"><code>a2enmod http2</code></pre>



<p>随后编辑Apache2的配置文件</p>



<pre class="wp-block-code"><code>vi /etc/apache2/apache2.conf</code></pre>



<p>在其结尾添加上：</p>



<pre class="wp-block-code"><code>Protocols h2 http/1.1</code></pre>



<p>重启PHP-fpm并查看其运行状态</p>



<pre class="wp-block-code"><code>service php7.4-fpm restart</code></pre>



<pre class="wp-block-code"><code>service php7.4-fpm status

service php8.1-fpm restart

service php8.1-fpm status</code></pre>



<p>最后重启apache2</p>



<pre class="wp-block-code"><code>service apache2 restart</code></pre>



<p>最后的最后，可以再自行检验下http2是否最终正常开启：</p>



<pre class="wp-block-code"><code>curl --http2 --head '网站url'</code></pre>



<p>若返回HTTP/2 200则网站即已支持http2。</p>



<p>注意：更新ubuntu系统后Apache2又会回到默认状态，此时需要重新设置一遍。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nfzx.org.cn/2023-08-26/%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%bb%b4%e6%8a%a4%e4%bc%98%e5%8c%96%e8%87%aa%e7%94%a8%e5%a4%87%e5%bf%98%e5%bd%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
