<?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>David&#039;s Blog</title>
	<atom:link href="http://wangblog.org/feed" rel="self" type="application/rss+xml" />
	<link>http://wangblog.org</link>
	<description></description>
	<lastBuildDate>Mon, 05 May 2025 12:26:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.4</generator>
	<item>
		<title>FreeBSD 13 安装无线网卡</title>
		<link>http://wangblog.org/2025/05/freebsd-13-wireless-network.html</link>
		<comments>http://wangblog.org/2025/05/freebsd-13-wireless-network.html#respond</comments>
		<pubDate>Mon, 05 May 2025 12:26:35 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10741</guid>
		<description><![CDATA[# uname -a FreeBSD 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64 # sysctl net.wlan.devices net.wlan.devices: iwm0 # pciconf -lv iwm0 iwm0@pci0:2:0:0: class=0x028000 rev=0x59 hdr=0x00 vendor=0x8086 device=0x095a subvendor=0x8086 subdevice=0x9010 vendor = &#8216;Intel Corporation&#8217; device = &#8216;Wireless 7265&#8217; class = network # ee /etc/rc.conf wlans_iwm0=&#8221;wlan0&#8243; ifconfig_wlan0=&#8221;WPA SYNCDHCP&#8221; # ee /etc/wpa_supplicant.conf network={ ssid=&#8221;WIFI 名字（SSID）&#8221;...]]></description>
				<content:encoded><![CDATA[<p># uname -a<br />
FreeBSD 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64</p>
<p># sysctl net.wlan.devices<br />
net.wlan.devices: iwm0</p>
<p># pciconf -lv iwm0<br />
iwm0@pci0:2:0:0:        class=0x028000 rev=0x59 hdr=0x00 vendor=0x8086 device=0x095a subvendor=0x8086 subdevice=0x9010<br />
    vendor     = &#8216;Intel Corporation&#8217;<br />
    device     = &#8216;Wireless 7265&#8217;<br />
    class      = network</p>
<p># ee /etc/rc.conf<br />
wlans_iwm0=&#8221;wlan0&#8243;<br />
ifconfig_wlan0=&#8221;WPA SYNCDHCP&#8221;</p>
<p># ee /etc/wpa_supplicant.conf<br />
network={<br />
	ssid=&#8221;WIFI 名字（SSID）&#8221;<br />
	psk=&#8221;WIFI 密码&#8221;<br />
}</p>
<p># ee /boot/loader.conf<br />
if_iwm_load=&#8221;YES&#8221;<br />
wlan_wep_load=&#8221;YES&#8221;<br />
wlan_ccmp_load=&#8221;YES&#8221;<br />
wlan_tkip_load=&#8221;YES&#8221;<br />
iwm7265fw_load=&#8221;YES&#8221;</p>
<p># reboot</p>
<p>相关文章 ：<br />
<a href="http://wangblog.org/2009/11/freebsd_8.html">FreeBSD 8.0-RELEASE 安装无线网卡的变化</a><br />
<a href="http://wangblog.org/2009/02/freebsd7-0t43.html">FreeBSD7.0无线网卡设置（T43） </a></p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2025/05/freebsd-13-wireless-network.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD开机文件系统出错(automatic file system check failed)</title>
		<link>http://wangblog.org/2022/04/freebsd-automatic-file-system-check-failed.html</link>
		<comments>http://wangblog.org/2022/04/freebsd-automatic-file-system-check-failed.html#respond</comments>
		<pubDate>Sat, 16 Apr 2022 03:51:58 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10738</guid>
		<description><![CDATA[FreeBSD 虚拟机系统，不能正常启动了。报下面的错误： 解决方法： /sbin/fsck -y /sbin/mount -a /sbin/reboot 有可能需要输入多次 /sbin/fsck -y 并且重启多次。]]></description>
				<content:encoded><![CDATA[<p>FreeBSD 虚拟机系统，不能正常启动了。报下面的错误：</p>
<p>解决方法：</p>
<p><code><br />
/sbin/fsck -y<br />
/sbin/mount -a<br />
/sbin/reboot<br />
</code></p>
<p>有可能需要输入多次 /sbin/fsck -y 并且重启多次。</p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2022/04/freebsd-automatic-file-system-check-failed.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>privoxy.exe  403 Path matches generic block pattern.</title>
		<link>http://wangblog.org/2021/11/privoxy-exe-403-path-matches-generic-block-pattern.html</link>
		<comments>http://wangblog.org/2021/11/privoxy-exe-403-path-matches-generic-block-pattern.html#respond</comments>
		<pubDate>Fri, 12 Nov 2021 17:26:07 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10735</guid>
		<description><![CDATA[privoxy 代理上网，错误403，提示 Request for blocked URL , Path matches generic block pattern. 编辑privoxy 的 config.txt ， 关闭 #actionsfile default.action # Main actions file 参考 https://github.com/cmv/cmv-app/issues/429]]></description>
				<content:encoded><![CDATA[<p>privoxy 代理上网，错误403，提示 Request for blocked URL ,  Path matches generic block pattern.</p>
<p>编辑privoxy 的 config.txt ， 关闭 #actionsfile default.action   # Main actions file</p>
<p>参考<br />
https://github.com/cmv/cmv-app/issues/429</p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2021/11/privoxy-exe-403-path-matches-generic-block-pattern.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>乌烟瘴气的国内互联网</title>
		<link>http://wangblog.org/2021/04/zhihu_zuoe.html</link>
		<comments>http://wangblog.org/2021/04/zhihu_zuoe.html#respond</comments>
		<pubDate>Wed, 21 Apr 2021 03:06:08 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10731</guid>
		<description><![CDATA[国内互联网最大的问题是无法完整流畅的使用网页内容。知乎、新浪、网易等，一定要提醒你下载app，有必要用app吗？浏览器能做的事为什么要用app，安装app无非是为了客户的隐私数据，做些见不得人的勾当。然后安装了app后就要所有的权限，推送更多的垃圾app和广告给你。原本只是在手机浏览器上作恶，现在PC端也不能幸免！ 浏览器现在也不是正经的浏览器！都是垃圾！]]></description>
				<content:encoded><![CDATA[<p>国内互联网最大的问题是无法完整流畅的使用网页内容。知乎、新浪、网易等，一定要提醒你下载app，有必要用app吗？浏览器能做的事为什么要用app，安装app无非是为了客户的隐私数据，做些见不得人的勾当。然后安装了app后就要所有的权限，推送更多的垃圾app和广告给你。原本只是在手机浏览器上作恶，现在PC端也不能幸免！</p>
<p>浏览器现在也不是正经的浏览器！都是垃圾！</p>
<p><a href="http://up.wangblog.org/static/2021-04/1618973759-TG9D10R66SRG1I838IT.png" target="_blank"><img src="http://up.wangblog.org/static/2021-04/1618973759-TG9D10R66SRG1I838IT.png" alt="1618973759-TG9D10R66SRG1I838IT.png" width="500px" /></a></p>
<p><a href="http://up.wangblog.org/static/2021-04/1618973770-IMG_20210420_013108.jpg" target="_blank"><img src="http://up.wangblog.org/static/2021-04/1618973770-IMG_20210420_013108.jpg" alt="1618973770-IMG_20210420_013108.jpg" width="500px" /></a></p>
<p><a href="http://up.wangblog.org/static/2021-04/1618973780-IMG_20210420_013055.jpg" target="_blank"><img src="http://up.wangblog.org/static/2021-04/1618973780-IMG_20210420_013055.jpg" alt="1618973780-IMG_20210420_013055.jpg" width="500px" /></a></p>
<p><a href="http://up.wangblog.org/static/2021-04/1618973792-IMG_20210420_013041.jpg" target="_blank"><img src="http://up.wangblog.org/static/2021-04/1618973792-IMG_20210420_013041.jpg" alt="1618973792-IMG_20210420_013041.jpg" width="500px" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2021/04/zhihu_zuoe.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决 MWS GetEligibleShippingServices 返回 SignatureDoesNotMatch</title>
		<link>http://wangblog.org/2020/03/mws-geteligibleshippingservices-signaturedoesnotmatch.html</link>
		<comments>http://wangblog.org/2020/03/mws-geteligibleshippingservices-signaturedoesnotmatch.html#respond</comments>
		<pubDate>Sat, 21 Mar 2020 16:07:42 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10728</guid>
		<description><![CDATA[今天写 MWS 的 Merchant Fulfillment ，调用  GetEligibleShippingServices 一直出错，返回 SignatureDoesNotMatch ，奇了怪？ 后来对比 MWS scratchpad 工具发现 ShipmentRequestDetails.ShipFromAddress 输入中有空格，而我的是“+” ，MWS scratchpad 是“%20”，所以 SignatureDoesNotMatch 。 我php版本是5.3.3，不能在 http_build_query 函数使用 PHP_QUERY_RFC3986 enc_type 默认使用 PHP_QUERY_RFC1738。 如果 enc_type 是 PHP_QUERY_RFC1738，则编码将会以 » RFC 1738 标准和 application/x-www-form-urlencoded 媒体类型进行编码，空格会被编码成加号（+）。 如果 enc_type 是 PHP_QUERY_RFC3986，将根据 » RFC 3986 编码，空格会被百分号编码（%20）。 写个函数转换下，问题解决了。 function arr2url($arr){ if(version_compare(PHP_VERSION, '5.4.0', '>=')){ return http_build_query($arr, null,...]]></description>
				<content:encoded><![CDATA[<p>今天写 MWS 的 Merchant Fulfillment ，调用  GetEligibleShippingServices 一直出错，返回 SignatureDoesNotMatch ，奇了怪？</p>
<p>后来对比 <a href="https://mws.amazonservices.com/scratchpad/index.html" target="_blank" rel="noopener">MWS scratchpad</a> 工具发现 ShipmentRequestDetails.ShipFromAddress 输入中有空格，而我的是“+” ，<a>MWS scratchpad</a> 是“%20”，所以 SignatureDoesNotMatch 。</p>
<p>我php版本是5.3.3，不能在 <a href="https://www.php.net/manual/zh/function.http-build-query.php" target="_blank" rel="noopener">http_build_query</a> 函数使用 PHP_QUERY_RFC3986</p>
<blockquote><p>enc_type<br />
默认使用 PHP_QUERY_RFC1738。</p>
<p>如果 enc_type 是 PHP_QUERY_RFC1738，则编码将会以 » RFC 1738 标准和 application/x-www-form-urlencoded 媒体类型进行编码，空格会被编码成加号（+）。</p>
<p>如果 enc_type 是 PHP_QUERY_RFC3986，将根据 » RFC 3986 编码，空格会被百分号编码（%20）。</p></blockquote>
<p>写个函数转换下，问题解决了。</p>
<pre class="brush: php">
function arr2url($arr){
	if(version_compare(PHP_VERSION, '5.4.0', '>=')){
		return http_build_query($arr, null, null, PHP_QUERY_RFC3986);
	}else{
		return str_replace('+', '%20', http_build_query($arr));
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2020/03/mws-geteligibleshippingservices-signaturedoesnotmatch.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>惠普 M1005 MFP第二张卡纸解决方法</title>
		<link>http://wangblog.org/2020/03/hp-m1005-mfp-bug.html</link>
		<comments>http://wangblog.org/2020/03/hp-m1005-mfp-bug.html#respond</comments>
		<pubDate>Sat, 29 Feb 2020 19:07:45 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10719</guid>
		<description><![CDATA[毛病跟这哥们的一样，参考下  http://machbbs.com/jdwx/40258 解决方法有些不同，离合器磁吸用酒精把粘胶清理干净后，我一开始是没有贴替代的上去，就直接装上，发现依然卡纸，然后再拆，贴了一张薄薄的双面胶不撕掉纸，就好了。 我估计可能是如果不贴一层的话磁吸就完全吸住了分不开，有一层隔离吸的力不会那么强。 然后，离合器很难取出来，我暴力一点，把挡板折弯了，完了再折回去没有毛病。 M1005 的拆机参考 https://wenku.baidu.com/view/42864420240c844768eaeed2.html 千万不要拆全部，只要拆右侧面板和后面板就可以了。]]></description>
				<content:encoded><![CDATA[<p>毛病跟这哥们的一样，参考下  http://machbbs.com/jdwx/40258</p>
<p>解决方法有些不同，离合器磁吸用酒精把粘胶清理干净后，我一开始是没有贴替代的上去，就直接装上，发现依然卡纸，然后再拆，贴了一张薄薄的双面胶不撕掉纸，就好了。</p>
<p>我估计可能是如果不贴一层的话磁吸就完全吸住了分不开，有一层隔离吸的力不会那么强。</p>
<p>然后，离合器很难取出来，我暴力一点，把挡板折弯了，完了再折回去没有毛病。</p>
<p><img src="http://up.wangblog.org/static/2020-03/1583003143-IMG_20200301_021310.jpg" alt="1583003143-IMG_20200301_021310.jpg" width="500px" /></p>
<p><img src="http://up.wangblog.org/static/2020-03/1583003132-IMG_20200301_021355.jpg" alt="1583003132-IMG_20200301_021355.jpg" width="500px" /></p>
<p>M1005 的拆机参考 https://wenku.baidu.com/view/42864420240c844768eaeed2.html<br />
千万不要拆全部，只要拆右侧面板和后面板就可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2020/03/hp-m1005-mfp-bug.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在 FreeBSD 上安装 Magento2</title>
		<link>http://wangblog.org/2019/07/freebsd-magento2.html</link>
		<comments>http://wangblog.org/2019/07/freebsd-magento2.html#respond</comments>
		<pubDate>Thu, 18 Jul 2019 18:26:00 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgerSQL]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10716</guid>
		<description><![CDATA[下载 magento，解压缩。 安装前先将magento下的文件夹全改为777权限，和chown -R www:www ./* # find . -type d -exec chmod 777 {} \; 安装后再将所有文件夹权限改为755，保留几个文件夹的777权限 # find . -type d -exec chmod 755 {} \; # chmod 777 ./app/etc # chmod 777 ./var # chmod 777 ./var/.htaccess # chmod 777 ./app/etc # chmod 777 ./pub/media # chmod 777 ./generated...]]></description>
				<content:encoded><![CDATA[<p>下载 <a href="https://magento.com/tech-resources/download" target="_blank" rel="noopener">magento</a>，解压缩。</p>
<p>安装前先将magento下的文件夹全改为777权限，和chown -R www:www ./*<br />
# find . -type d -exec chmod 777 {} \;<br />
安装后再将所有文件夹权限改为755，保留几个文件夹的777权限<br />
# find . -type d -exec chmod 755 {} \;<br />
# chmod 777 ./app/etc<br />
# chmod 777 ./var<br />
# chmod 777 ./var/.htaccess<br />
# chmod 777 ./app/etc<br />
# chmod 777 ./pub/media<br />
# chmod 777 ./generated<br />
# find ./var -type d -exec chmod 777 {} \;</p>
<p>参考：<a href="https://devdocs.magento.com/guides/v2.3/config-guide/prod/prod_file-sys-perms.html" target="_blank" rel="noopener">https://devdocs.magento.com/guides/v2.3/install-gde/install/legacy-file-system-perms.html</a></p>
<p>打开 magento/setup/ 开始安装，带有样本数据的安装多半会失败，可能php内存不够。先安装不带数据，再导入吧。</p>
<p>magento 安装期间显示例外。<br />
清除&lt;magento_root&gt;/generated/code之下，其他目录var和generated如下：<br />
# cd magento<br />
# rm -rf ./generated/code/* ./generated/metadata/* ./var/cache/*</p>
<p>并且清除cookie，再重新安装。</p>
<p>导入样本数据库，参考教程， <a href="https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-sample-data-clone.html" target="_blank" rel="noopener">https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-sample-data-clone.html</a></p>
<p># cd magento</p>
<p># php bin/magento setup:upgrade</p>
<p>可能会提示php内存不够，重新设置下内存就好</p>
<p># ee /usr/local/etc/php.ini<br />
memory_limit = 2048M</p>
<p># /usr/local/etc/rc.d/php-fpm restart</p>
<p>重启php，即可</p>
<p>装完 magento 2.3.2 第二天就删除了，因为不支持PostGreSQL数据库，而且运行速度极其慢。</p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2019/07/freebsd-magento2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess 和 .user.ini</title>
		<link>http://wangblog.org/2019/07/htaccess-user-ini.html</link>
		<comments>http://wangblog.org/2019/07/htaccess-user-ini.html#comments</comments>
		<pubDate>Wed, 17 Jul 2019 13:02:10 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10712</guid>
		<description><![CDATA[FreeBSD 12 下 apache 2.4 ee /usr/local/etc/apache24/httpd.conf &#60;Directory /&#62; &#8230; AllowOverride None 改为 AllowOverride All &#8230; &#60;/Directory&#62; 重启 apachectl restart 如果 .htaccess php_flag display_errors on 报500错误了，查看apache的error_log找到了如下的错误信息： .htaccess: Invalid command &#8216;php_flag&#8217;, perhaps misspelled or defined by a module not included in the server configuration 是suPHP的问题，写另外一个文件&#8221;.user.ini&#8221; error_reporting = E_ALL display_errors = On...]]></description>
				<content:encoded><![CDATA[<p>FreeBSD 12 下</p>
<p>apache 2.4<br />
ee /usr/local/etc/apache24/httpd.conf<br />
&lt;Directory /&gt;<br />
&#8230;<br />
AllowOverride None 改为 AllowOverride All<br />
&#8230;<br />
&lt;/Directory&gt;<br />
重启 apachectl restart</p>
<p>如果 .htaccess<br />
php_flag display_errors on<br />
报500错误了，查看apache的error_log找到了如下的错误信息：<br />
.htaccess: Invalid command &#8216;php_flag&#8217;, perhaps misspelled or defined by a module not included in the server configuration<br />
是suPHP的问题，写另外一个文件&#8221;.user.ini&#8221;<br />
error_reporting = E_ALL<br />
display_errors = On<br />
更改过&#8221;.user.ini&#8221;要重启php-fpm生效<br />
#/usr/local/etc/rc.d/php-fpm restart</p>
<p><a href="https://www.php.net/manual/zh/configuration.file.per-user.php">https://www.php.net/manual/zh/configuration.file.per-user.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2019/07/htaccess-user-ini.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ThinkPad T440p 在 win10 显示 CapsLock 键桌面提示</title>
		<link>http://wangblog.org/2019/02/thinkpad-t440p-win10-capslock-hotkey.html</link>
		<comments>http://wangblog.org/2019/02/thinkpad-t440p-win10-capslock-hotkey.html#respond</comments>
		<pubDate>Thu, 21 Feb 2019 09:53:22 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[ThinkPad]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10708</guid>
		<description><![CDATA[ThinkPad T440p 装windows10系统之后，更换大小写的时候再也没有提示了，以前Win7是有的，提示一下比较直观。 可以通过“切换到桌面空白处点右键——显示设置——高级显示设置——显示适配器属性——屏幕配置”解决。 如果不能设置就检查下 Hotkey 驱动有没有安装。 想要不显示也是一样的操作，选择关闭就可以！]]></description>
				<content:encoded><![CDATA[<p>ThinkPad T440p 装windows10系统之后，更换大小写的时候再也没有提示了，以前Win7是有的，提示一下比较直观。</p>
<p><img src="http://up.wangblog.org/static/2019-02/1550742551-IMG_20190221_174145.jpg" alt="ThinkPad T440p 在 win10 显示 CapsLock 键桌面提示" width="500px" /></p>
<p>可以通过“切换到桌面空白处点右键——显示设置——高级显示设置——显示适配器属性——屏幕配置”解决。</p>
<p><img src="http://up.wangblog.org/static/2019-02/1550742630-IMG_20190221_174253.jpg" alt="ThinkPad T440p 在 win10 显示 CapsLock 键桌面提示" width="500px" /></p>
<p>如果不能设置就检查下 Hotkey 驱动有没有安装。</p>
<p>想要不显示也是一样的操作，选择关闭就可以！</p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2019/02/thinkpad-t440p-win10-capslock-hotkey.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian安装Nginx，PHP，SSL，并且与Apache同时工作</title>
		<link>http://wangblog.org/2018/08/debian-nginx-php-ssl-apache.html</link>
		<comments>http://wangblog.org/2018/08/debian-nginx-php-ssl-apache.html#respond</comments>
		<pubDate>Sun, 26 Aug 2018 19:23:38 +0000</pubDate>
		<dc:creator><![CDATA[david]]></dc:creator>
				<category><![CDATA[Servers]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[未分类]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://wangblog.org/?p=10692</guid>
		<description><![CDATA[折腾下 Nginx 和 Nginx擅长的反向代理。 巩固一下SSL和Apache。 不废话，开始 🙂 # apt-get update # apachectl stop //暂时关闭apache，80端口冲突，安装会失败 # apt-get install nginx // dependency problems - leaving unconfigured - 如果安装过程中有提示依赖性问题的话，把依赖的安装起来再重新install nginx的命令： systemctl stop nginx systemctl start nginx systemctl restart nginx systemctl status nginx systemctl reload nginx systemctl enable nginx # vim /etc/nginx/nginx.conf # vim...]]></description>
				<content:encoded><![CDATA[<p>折腾下 <a href="https://nginx.org/" target="_blank" rel="noopener">Nginx</a> 和 Nginx擅长的反向代理。</p>
<p>巩固一下SSL和Apache。</p>
<p>不废话，开始 <img src="https://s.w.org/images/core/emoji/2.4/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><span id="more-10692"></span></p>
<pre class="brush: powershell">
# apt-get update
# apachectl stop
//暂时关闭apache，80端口冲突，安装会失败
# apt-get install nginx
// dependency problems - leaving unconfigured - 如果安装过程中有提示依赖性问题的话，把依赖的安装起来再重新install
</pre>
<p>nginx的命令：<br />
systemctl stop nginx<br />
systemctl start nginx<br />
systemctl restart nginx<br />
systemctl status nginx<br />
systemctl reload nginx<br />
systemctl enable nginx</p>
<pre class="brush: powershell">
# vim /etc/nginx/nginx.conf
# vim /etc/nginx/sites-available/default

server {
        listen 7000 default_server;
        listen 127.0.0.1:80 default_server;
           //不能与apache的80端口冲突，改7000端口。和按IP地址来对应端口，就不会冲突，如果有多个IP地址的主机，就可以按IP配端口

        # SSL configuration
        #
        listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
          include snippets/snakeoil.conf;
             //SSL配置文件

        root /var/www/nginx;

        server_name xxx.com;
......
</pre>
<p>Nginx通过PHP-FPM来工作</p>
<pre class="brush: powershell">
# apt-get install php5-fpm
# vim /etc/nginx/sites-available/default

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php5-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
        }
</pre>
<p>PHP搞定，下面开始配置SSL</p>
<pre class="brush: powershell">
# mkdir /etc/nginx/ssl
# openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.csr
</pre>
<p>参数-nodes 取消密码，需要密码的同志去掉这个参数<br />
Generating a 2048 bit RSA private key<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..+++<br />
&#8230;&#8230;&#8230;..+++<br />
writing new private key to &#8216;/etc/nginx/ssl/server.key&#8217;<br />
&#8212;&#8211;<br />
You are about to be asked to enter information that will be incorporated<br />
into your certificate request.<br />
What you are about to enter is what is called a Distinguished Name or a DN.<br />
There are quite a few fields but you can leave some blank<br />
For some fields there will be a default value,<br />
If you enter &#8216;.&#8217;, the field will be left blank.<br />
&#8212;&#8211;<br />
Country Name (2 letter code) [AU]:国家代码<br />
State or Province Name (full name) [Some-State]:省<br />
Locality Name (eg, city) []:市<br />
Organization Name (eg, company) [Internet Widgits Pty Ltd]:公司<br />
Organizational Unit Name (eg, section) []:部门<br />
Common Name (e.g. server FQDN or YOUR name) []:xxxx.com // RapidSSL Wildcard 通配符的清加 *.xxxx.com<br />
Email Address []:不需要</p>
<p>Please enter the following &#8216;extra&#8217; attributes<br />
to be sent with your certificate request<br />
A challenge password []:不需要<br />
An optional company name []:不需要</p>
<p>有时需要去除密码，这样做，因为没有密码文件Nginx启动错误</p>
<pre class="brush: powershell">
# openssl rsa -in server.key -out server-nopassword.key
</pre>
<p>上传server.csr给RapidSSL得到INTERMEDIATE CA，保存为INTERMEDIATE.crt<br />
INTERMEDIATE.crt格式为<br />
&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />
&#8230;&#8230;<br />
&#8212;&#8211;END CERTIFICATE&#8212;&#8211;<br />
单个证书放这里</p>
<p>server.crt格式为<br />
Web Server CERTIFICATE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />
&#8230;&#8230;<br />
&#8212;&#8211;END CERTIFICATE&#8212;&#8211;</p>
<p>INTERMEDIATE CA:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />
&#8230;&#8230;<br />
&#8212;&#8211;END CERTIFICATE&#8212;&#8211;<br />
服务器所有的证书，放在这里</p>
<p>server.key server.csr server.crt INTERMEDIATE.crt 这些文件可以复制到其他服务器使用<br />
续约时，上传server.csr得到新的INTERMEDIATE.crt，加入server.crt，重启Nginx或者apache就可以了</p>
<pre class="brush: powershell">
# cat INTERMEDIATE.crt &gt;&gt; server.crt

# vim /etc/nginx/snippets/snakeoil.conf

       ssl_certificate /etc/nginx/ssl/server.crt;
       ssl_certificate_key /etc/nginx/ssl/server.key;

# systemctl restart nginx
</pre>
<p>开始apache的配置</p>
<pre class="brush: powershell">
# vim /etc/apache2/apache2.conf
# vim /etc/apache2/ports.conf
       Listen x.x.x.x:80
# vim /etc/apache2/sites-available/000-default.conf
      &lt;VirtualHost x.x.x.x:80&gt;
      都是ip:端口的格式 ，参考 https://httpd.apache.org/docs/2.4/vhosts/examples.html
      

# apachectl configtest
# apachectl restart
</pre>
<p>Nginx 反向代理</p>
<pre class="brush: powershell">
# vim /etc/nginx/sites-available/default

       location / {
            proxy_pass  https://proxy.com/;
       }
</pre>
<p>访问443的网站都会变成proxy.com的内容，包括header</p>
<p>安装结束，apache外ip的80端口，Nginx内部的80端口和外ip的443端口，然后就可以用Nginx做反向代理。</p>
<p>参考：<br />
<a href="http://rapidssl.com" target="_blank" rel="noopener">rapidssl.com</a><br />
<a href="http://cheapsslsecurity.com" target="_blank" rel="noopener">cheapsslsecurity.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wangblog.org/2018/08/debian-nginx-php-ssl-apache.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
