<?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/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8%e8%bf%90%e7%bb%b4/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nfzx.org.cn</link>
	<description>我的建筑图像日志</description>
	<lastBuildDate>Wed, 16 Jul 2025 07:43:54 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</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>博客维护优化自用备忘录</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>
