<?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>Linux 彙整 - 碼蟻創研工坊 - CODEANT STUDIOS</title>
	<atom:link href="http://codeant.cc/archives/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://codeant.cc/archives/category/linux</link>
	<description></description>
	<lastBuildDate>Sat, 31 Oct 2020 01:13:54 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>http://codeant.cc/wp-content/uploads/2020/10/cropped-Code-Ant-Logo-2-32x32.png</url>
	<title>Linux 彙整 - 碼蟻創研工坊 - CODEANT STUDIOS</title>
	<link>http://codeant.cc/archives/category/linux</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>直接關閉 WordPress 的文章迴響功能</title>
		<link>http://codeant.cc/archives/262</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Sun, 11 Oct 2020 04:31:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/?p=262</guid>

					<description><![CDATA[<p>關閉文章迴響功能最直接有效的方式，就是直接修改 wp-content/themes/ 下的程式碼，直接禁用 c [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/262">直接關閉 WordPress 的文章迴響功能</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>關閉文章迴響功能最直接有效的方式，就是直接修改 wp-content/themes/ 下的程式碼，直接禁用 comments_template()，很粗暴很有效。</p>



<p>雖然可以在系統或是文章去做個別的設定，但我還是喜歡這種方式。</p>



<p>Step 1: 找出 comments_template()</p>



<pre class="wp-block-code"><code>grep comments_template *</code></pre>



<p>Step 2: 註解相關頁面的程式碼</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="701" height="137" src="http://codeant.cc/wp-content/uploads/2020/10/wordpress_dis_comments.png" alt="" class="wp-image-263" srcset="http://codeant.cc/wp-content/uploads/2020/10/wordpress_dis_comments.png 701w, http://codeant.cc/wp-content/uploads/2020/10/wordpress_dis_comments-300x59.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&amp;linkname=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F262&#038;title=%E7%9B%B4%E6%8E%A5%E9%97%9C%E9%96%89%20WordPress%20%E7%9A%84%E6%96%87%E7%AB%A0%E8%BF%B4%E9%9F%BF%E5%8A%9F%E8%83%BD" data-a2a-url="http://codeant.cc/archives/262" data-a2a-title="直接關閉 WordPress 的文章迴響功能"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/262">直接關閉 WordPress 的文章迴響功能</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>修正 PHP 7.4 無法使用 mcrypt_decrypt() 的問題</title>
		<link>http://codeant.cc/archives/259</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Sun, 11 Oct 2020 04:18:13 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/?p=259</guid>

					<description><![CDATA[<p>這個問題其實在 PHP 7.2 就已經發生了，所以 PHP 7.4 也無法避免的會遇到，原因是： 必須安裝額外 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/259">修正 PHP 7.4 無法使用 mcrypt_decrypt() 的問題</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>這個問題其實在 PHP 7.2 就已經發生了，所以 PHP 7.4 也無法避免的會遇到，原因是：</p>



<figure class="wp-block-image size-large"><img decoding="async" width="846" height="223" src="http://codeant.cc/wp-content/uploads/2020/10/php_74_mcrypt.png" alt="" class="wp-image-266" srcset="http://codeant.cc/wp-content/uploads/2020/10/php_74_mcrypt.png 846w, http://codeant.cc/wp-content/uploads/2020/10/php_74_mcrypt-300x79.png 300w, http://codeant.cc/wp-content/uploads/2020/10/php_74_mcrypt-768x202.png 768w" sizes="(max-width: 846px) 100vw, 846px" /></figure>



<p>必須安裝額外的套件才能提供，步驟如下：</p>



<span id="more-259"></span>



<p>Step 1: 安裝函式庫</p>



<pre class="wp-block-code"><code>sudo apt-get install libmcrypt-dev php7.4-dev
sudo pecl install mcrypt-1.0.3</code></pre>



<p>Step 2: 修改 php.ini 啟用功能，增加1行設定如下：</p>



<pre class="wp-block-code"><code>extension=mcrypt.so</code></pre>



<p>Step 3: 重啟 PHP 載入新設定</p>



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



<p>Step 4: 使用 phpinfo() 確認 mcrypt 已啟用</p>



<figure class="wp-block-image size-large"><img decoding="async" width="950" height="302" src="http://codeant.cc/wp-content/uploads/2020/10/php7.4-mcrypt.png" alt="" class="wp-image-260" srcset="http://codeant.cc/wp-content/uploads/2020/10/php7.4-mcrypt.png 950w, http://codeant.cc/wp-content/uploads/2020/10/php7.4-mcrypt-300x95.png 300w, http://codeant.cc/wp-content/uploads/2020/10/php7.4-mcrypt-768x244.png 768w" sizes="(max-width: 950px) 100vw, 950px" /></figure>



<p></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&amp;linkname=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F259&#038;title=%E4%BF%AE%E6%AD%A3%20PHP%207.4%20%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8%20mcrypt_decrypt%28%29%20%E7%9A%84%E5%95%8F%E9%A1%8C" data-a2a-url="http://codeant.cc/archives/259" data-a2a-title="修正 PHP 7.4 無法使用 mcrypt_decrypt() 的問題"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/259">修正 PHP 7.4 無法使用 mcrypt_decrypt() 的問題</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ubuntu 16.04 安裝 PHP 7.4</title>
		<link>http://codeant.cc/archives/257</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Sun, 11 Oct 2020 03:58:26 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/?p=257</guid>

					<description><![CDATA[<p>原本 Ubuntu 16.04 預設的 PHP 版本為 7.0.x，無發自動更新到 PHP 7.4.x，有點可 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/257">Ubuntu 16.04 安裝 PHP 7.4</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>原本 Ubuntu 16.04 預設的 PHP 版本為 7.0.x，無發自動更新到 PHP 7.4.x，有點可惜，畢竟 PHP 7.4 有著更好的效能。</p>



<p>下面簡單紀錄一下整個升級安裝的過程：</p>



<span id="more-257"></span>



<p>Step 1: 新增 PHP PPA Repository</p>



<pre class="wp-block-code"><code>sudo apt-get update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update</code></pre>



<p>Step 2: 安裝 PHP 7.4</p>



<pre class="wp-block-code"><code>sudo apt install php7.4
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl php7.4-bcmath php7.4-bz2 php7.4-fpm</code></pre>



<p>Step 3: 檢查 PHP 版本</p>



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



<pre class="wp-block-code"><code>~$ php -v
PHP 7.4.11 (cli) (built: Oct  6 2020 10:35:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies</code></pre>



<p>Step 4: 啟用 PHP 7.4 FPM 模組</p>



<pre class="wp-block-code"><code>sudo a2disconf php7.0-fpm
sudo a2enconf php7.4-fpm
sudo service apache2 stop
sudo a2dismod mpm_prefork php7.4 
sudo a2enmod mpm_event
sudo service php7.4-fpm restart
sudo service apache2 restart</code></pre>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&amp;linkname=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F257&#038;title=Ubuntu%2016.04%20%E5%AE%89%E8%A3%9D%20PHP%207.4" data-a2a-url="http://codeant.cc/archives/257" data-a2a-title="Ubuntu 16.04 安裝 PHP 7.4"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/257">Ubuntu 16.04 安裝 PHP 7.4</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>讓 Apache 具備基本的防 DoS 攻擊能力！</title>
		<link>http://codeant.cc/archives/171</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Sun, 15 Jan 2017 21:24:36 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/16/apache-dos-defend/</guid>

					<description><![CDATA[<p>evasive 這個模組可以提供 Apache 基本的防 DoS 能力，注意，這指的是 DoS 而非 DDoS [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/171">讓 Apache 具備基本的防 DoS 攻擊能力！</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">evasive 這個模組可以提供 Apache 基本的防 DoS 能力，注意，這指的是 DoS 而非 DDoS ，因為 evasive 主要就是依同一 IP 的單位時間連線數請求來作為防禦的依據，對於 DDoS 並沒有太大的效用，但是對於 DoS 則是非常不錯了。</p>
<p style="font-size: 16px; line-height: 26px;">在Ubuntu 16.04 LTS 下的安裝指令如下：</p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install libapache2-mod-evasive 
sudo mkdir /var/log/mod_evasive 
sudo chown www-data:www-data /var/log/mod_evasive/ 
sudo vim /etc/apache2/mods-available/evasive.conf 
sudo a2enmod evasive sudo service apache2 restart</pre>
<p style="font-size: 16px; line-height: 26px;">安裝之後你必須修改  /etc/apache2/mods-available/evasive.conf 設定檔，簡單的設定內容如下：</p>
<p><span id="more-171"></span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">DOSHashTableSize    3097 
DOSPageCount        2 
DOSSiteCount        50 
DOSPageInterval     1 
DOSSiteInterval     1 
DOSBlockingPeriod   10 
DOSLogDir           "/var/log/mod_evasive"</pre>
<p style="font-size: 16px; line-height: 26px;">實際上使用，其實預設值是有點嚴苛，我自己是修改如下：</p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">DOSPageCount   3 
DOSSiteCount   70</pre>
<p style="font-size: 16px; line-height: 26px;">而且使用上要注意，evasive 無法在 .htaccess 檔案中進行設定。</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&amp;linkname=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F171&#038;title=%E8%AE%93%20Apache%20%E5%85%B7%E5%82%99%E5%9F%BA%E6%9C%AC%E7%9A%84%E9%98%B2%20DoS%20%E6%94%BB%E6%93%8A%E8%83%BD%E5%8A%9B%EF%BC%81" data-a2a-url="http://codeant.cc/archives/171" data-a2a-title="讓 Apache 具備基本的防 DoS 攻擊能力！"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/171">讓 Apache 具備基本的防 DoS 攻擊能力！</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MySQL 資料庫效能調校的好幫手 mysqltuner.pl</title>
		<link>http://codeant.cc/archives/162</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 01:11:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/09/mysqltuner-mysql-tunning/</guid>

					<description><![CDATA[<p>除了用 PHPMyAdmin 來進行 MySQL 資料庫的性能優化之外，mysqltuner.pl 這一個用  [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/162">MySQL 資料庫效能調校的好幫手 mysqltuner.pl</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">除了用 PHPMyAdmin 來進行 MySQL 資料庫的性能優化之外，mysqltuner.pl 這一個用 Perl 寫成的 Script 也是相當實用的小幫手，我都是用來做 double check 用的，安裝跟使用上也是簡易的等級，學習曲線並不高。</p>
<p><span id="more-162"></span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">wget http://mysqltuner.pl/ -O mysqltuner.pl <br />wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt <br />wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv <br />perl mysqltuner.pl</pre>
<p style="font-size: 16px; line-height: 26px;">運行這個 Script 時，首先你必須輸入具有完整權限的帳號跟密碼（通常是 root），過程中也會出現目前的環境參數設定，最後給出參數跟性能調校的建議，隨著你的網站逐漸成長，參數的條件也會有不同，建議每隔一段時間你都應該再度進行測試，確認適合當下網站的使用情況。</p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-161" style="display: block; margin-left: auto; margin-right: auto;" src="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_170055.png" alt="Screenshot from 2017 01 09 170055" width="754" height="243" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_170055.png 754w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_170055-300x97.png 300w" sizes="auto, (max-width: 754px) 100vw, 754px" /></p>


<p></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&amp;linkname=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F162&#038;title=MySQL%20%E8%B3%87%E6%96%99%E5%BA%AB%E6%95%88%E8%83%BD%E8%AA%BF%E6%A0%A1%E7%9A%84%E5%A5%BD%E5%B9%AB%E6%89%8B%20mysqltuner.pl" data-a2a-url="http://codeant.cc/archives/162" data-a2a-title="MySQL 資料庫效能調校的好幫手 mysqltuner.pl"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/162">MySQL 資料庫效能調校的好幫手 mysqltuner.pl</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>用PHPMyAdmin幫MySQL資料庫進行效能優化</title>
		<link>http://codeant.cc/archives/160</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 00:52:48 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/09/mysql-tunning-phpmyadmin/</guid>

					<description><![CDATA[<p>PHPMyAdmin 這套軟體絕對是使用 LAMP 環境架設網站的必裝套件之一，它的功能還包含 MySQL 資 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/160">用PHPMyAdmin幫MySQL資料庫進行效能優化</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">PHPMyAdmin 這套軟體絕對是使用 LAMP 環境架設網站的必裝套件之一，它的功能還包含 MySQL 資料庫的效能優化，對於網站效能，我們錙銖必較，而資料庫的效能調校，你絕對不能忽視。</p>
<p>  <span id="more-160"></span>  </p>
<p style="font-size: 16px; line-height: 26px;">使用上也是非常簡單，只要進入 PHPMyAdmin 的首頁之後，點選&#8221;狀態&#8221;就可以看到 MySQL 的運行結果統計，你只要再點選&#8221;建議&#8221;就可以看到效能分析及參數調校的建議事項，對於想要讓 MySQL 資料庫效率達到一拜的人來說，不能錯過。</p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-158" src="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_165138.png" alt="Screenshot from 2017 01 09 165138" width="1106" height="625" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_165138.png 1106w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_165138-300x170.png 300w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_165138-1024x579.png 1024w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_165138-768x434.png 768w" sizes="auto, (max-width: 1106px) 100vw, 1106px" /></p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-159" src="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_164933.png" alt="Screenshot from 2017 01 09 164933" width="1010" height="573" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_164933.png 1010w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_164933-300x170.png 300w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-09_164933-768x436.png 768w" sizes="auto, (max-width: 1010px) 100vw, 1010px" /></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&amp;linkname=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F160&#038;title=%E7%94%A8PHPMyAdmin%E5%B9%ABMySQL%E8%B3%87%E6%96%99%E5%BA%AB%E9%80%B2%E8%A1%8C%E6%95%88%E8%83%BD%E5%84%AA%E5%8C%96" data-a2a-url="http://codeant.cc/archives/160" data-a2a-title="用PHPMyAdmin幫MySQL資料庫進行效能優化"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/160">用PHPMyAdmin幫MySQL資料庫進行效能優化</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>如何讓 str_replace 只取代第一個出現的字串？</title>
		<link>http://codeant.cc/archives/156</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Wed, 04 Jan 2017 01:06:35 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/04/repleace-first-string-php/</guid>

					<description><![CDATA[<p>有需求就會去開發，如果沒有現成的可用的時候，有時候就是會想要只取代第一個出現的目標字串，下面的 PHP 程式碼 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/156">如何讓 str_replace 只取代第一個出現的字串？</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">有需求就會去開發，如果沒有現成的可用的時候，有時候就是會想要只取代第一個出現的目標字串，下面的 PHP 程式碼可以滿足這個功能，你也可指定要取代的次數。</p>
<p> </p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">function str_replace_count ($search, $replace, $subject, $count = 1)<br />{ 	<br />    $search = '/'.preg_quote($search, '/').'/';  	<br />    return preg_replace($search, $replace, $subject, $count); <br />}<br /><br />// Test <br />$subject = "abc123456abc789654abc456abc123";  <br />$search  = "abc"; <br />$replace = "xxyyzz";<br />  <br />echo "Replace once : ".str_replace_count($search, $replace, $subject)."\n"; <br />echo "Replace twice: ".str_replace_count($search, $replace, $subject, 2)."\n";</pre>
<p style="font-size: 16px; line-height: 26px;"> 下面是測試的結果：</p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">Replace once : xxyyzz123456abc789654abc456abc123 <br />Replace twice: xxyyzz123456xxyyzz789654abc456abc123</pre>


<p></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&amp;linkname=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F156&#038;title=%E5%A6%82%E4%BD%95%E8%AE%93%20str_replace%20%E5%8F%AA%E5%8F%96%E4%BB%A3%E7%AC%AC%E4%B8%80%E5%80%8B%E5%87%BA%E7%8F%BE%E7%9A%84%E5%AD%97%E4%B8%B2%EF%BC%9F" data-a2a-url="http://codeant.cc/archives/156" data-a2a-title="如何讓 str_replace 只取代第一個出現的字串？"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/156">如何讓 str_replace 只取代第一個出現的字串？</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ubuntu 16.04 LTS 的 LAMP 環境架設</title>
		<link>http://codeant.cc/archives/155</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Tue, 03 Jan 2017 23:56:38 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/04/lamp-install-ubuntu-16-04/</guid>

					<description><![CDATA[<p>當初是為了開發 Android 系統而開始使用 Ubuntu 12.04，過程中其實也沒有時麼不適應的問題，作 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/155">Ubuntu 16.04 LTS 的 LAMP 環境架設</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">當初是為了開發 Android 系統而開始使用 Ubuntu 12.04，過程中其實也沒有時麼不適應的問題，作為一個開發人員，挑系統也不是一個很正確的行為，也因此讓我變成 CentOS（伺服器）,  openSUSE（筆電）, Ubuntu(Android 開發) 三刀流。但是在AWS(Amazon Web Services) 的 EC2 上，我其實是選用 Ubuntu 16.04 來作為我的 <span style="color: #444444; font-family: 'Courier New', Courier, mono; font-size: 16px;">t2.micro instance 的作業系統。</span></p>
<p style="font-size: 16px; line-height: 26px;">下面簡單紀錄一下啟動 LAMP 環境的安裝過程：</p>
<p><span id="more-155"></span></p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-154" style="display: block; margin-left: auto; margin-right: auto;" src="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-04_153818.png" alt="Screenshot from 2017 01 04 153818" width="603" height="336" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-04_153818.png 603w, http://codeant.cc/wp-content/uploads/2017/01/images_Screenshot_from_2017-01-04_153818-300x167.png 300w" sizes="auto, (max-width: 603px) 100vw, 603px" /></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install htop 
sudo apt-get install lamp-server^ 
sudo apt-get install php-fpm php-json php-mcrypt php-curl php-gd php-bcmath php-bz2 
sudo apt-get install imagemagick phpmyadmin sendmail php-mail snmp
sudo vim /etc/php/7.0/fpm/pool.d/www.conf  
sudo vim /etc/apache2/conf-available/php7.0-fpm.conf 
sudo apt-get install libapache2-mod-fastcgi 
sudo a2enconf php7.0-fpm 
sudo a2dismod php7.0 mpm_prefork 
sudo a2enmod actions fastcgi alias mpm_event proxy_fcgi
sudo systemctl restart php7.0-fpm apache2 mysql 
htop</pre>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&amp;linkname=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F155&#038;title=Ubuntu%2016.04%20LTS%20%E7%9A%84%20LAMP%20%E7%92%B0%E5%A2%83%E6%9E%B6%E8%A8%AD" data-a2a-url="http://codeant.cc/archives/155" data-a2a-title="Ubuntu 16.04 LTS 的 LAMP 環境架設"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/155">Ubuntu 16.04 LTS 的 LAMP 環境架設</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>安裝 Webalizer 來觀察網站訪客情況</title>
		<link>http://codeant.cc/archives/153</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Tue, 03 Jan 2017 23:20:11 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2017/01/04/ubuntu-16-04-webalizer-install/</guid>

					<description><![CDATA[<p>當你採取自己管理主機來架設網站的時候，你可以使用 Webalizer 來觀察網站的訪問情況，Webalizer [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/153">安裝 Webalizer 來觀察網站訪客情況</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px;">當你採取自己管理主機來架設網站的時候，你可以使用 Webalizer 來觀察網站的訪問情況，<span style="color: #333333; font-family: NotoSansTC, gMuli, 'Helvetica Neue', Helvetica, Arial, sans-serif;">Webalizer 主要是使用 Apache Web Server 的 access.log 來進行分析統計，在安裝上不管是 CentOS &nbsp;或是 Ubuntu 系統都提供相當方便的方式，下面我們以 &nbsp;Ubuntu 16.04 LTS 來當作例子。</span></p>
<p style="font-size: 16px; line-height: 26px;">安裝指令：</p>
<p>  <span id="more-153"></span>  </p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install webalizer</pre>
<p style="font-size: 16px; line-height: 26px;">真的是一點都不難！</p>
<p style="font-size: 16px; line-height: 26px;">&nbsp;</p>
<p style="font-size: 16px; line-height: 26px;">設定上 Webalizer &nbsp;的設定檔路徑為：</p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">/etc/webalizer/webalizer.conf</pre>
<p style="font-size: 16px; line-height: 26px;">至少 <strong>HostName, OutputDir, LogFile</strong> 這三個參數你要設定好，才能正常運作。</p>
<p style="font-size: 16px; line-height: 26px;">&nbsp;</p>
<p style="font-size: 16px; line-height: 26px;">如果你有很多網站架在同一個主機上呢（<strong style="font-family: 'Times New Roman'; font-size: 13.3333px;">multiple virtual hosts</strong>）？那麼你必須先建立多個設定檔去搭配每一個網站，然後用下面的指令進行分析即可。</p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">for i in /etc/webalizer/*.conf; do webalizer -c $i; done</pre>
<p>&nbsp;</p>
<p style="font-size: 16px; line-height: 26px;">下面是結果圖表的範例：</p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-151" src="http://codeant.cc/wp-content/uploads/2017/01/images_daily_usage_201304.png" alt="daily usage 201304" style="display: block; margin-left: auto; margin-right: auto;" width="512" height="400" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_daily_usage_201304.png 512w, http://codeant.cc/wp-content/uploads/2017/01/images_daily_usage_201304-300x234.png 300w" sizes="auto, (max-width: 512px) 100vw, 512px" /></p>
<p style="font-size: 16px; line-height: 26px;">&nbsp;如果搭配 Geo_IP ，還可以產生訪客的來源地區百分比。</p>
<p><img loading="lazy" decoding="async" class=" size-full wp-image-152" src="http://codeant.cc/wp-content/uploads/2017/01/images_ctry_usage_201305.png" alt="ctry usage 201305" style="display: block; margin-left: auto; margin-right: auto;" width="512" height="300" srcset="http://codeant.cc/wp-content/uploads/2017/01/images_ctry_usage_201305.png 512w, http://codeant.cc/wp-content/uploads/2017/01/images_ctry_usage_201305-300x176.png 300w" sizes="auto, (max-width: 512px) 100vw, 512px" /></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&amp;linkname=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F153&#038;title=%E5%AE%89%E8%A3%9D%20Webalizer%20%E4%BE%86%E8%A7%80%E5%AF%9F%E7%B6%B2%E7%AB%99%E8%A8%AA%E5%AE%A2%E6%83%85%E6%B3%81" data-a2a-url="http://codeant.cc/archives/153" data-a2a-title="安裝 Webalizer 來觀察網站訪客情況"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/153">安裝 Webalizer 來觀察網站訪客情況</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>如何製作 Ubuntu DEB  安裝檔</title>
		<link>http://codeant.cc/archives/146</link>
		
		<dc:creator><![CDATA[codeant]]></dc:creator>
		<pubDate>Sun, 07 Jun 2015 23:33:43 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">http://codeant.cc/2015/06/08/how-to-build-ubuntu-deb-file/</guid>

					<description><![CDATA[<p>一般來說，可以有三種方式來製作適合  Ubuntu  的 DEB  套件安裝檔，如下: 1. 使用 RPM 安 [&#8230;]</p>
<p>這篇文章 <a href="http://codeant.cc/archives/146">如何製作 Ubuntu DEB  安裝檔</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p style="font-size: 16px; line-height: 26px; text-align: left;"><span style="font-family: comic sans ms,sans-serif; font-size: 12pt;">一般來說，可以有三種方式來製作適合  Ubuntu  的 DEB  套件安裝檔，如下:</span></p>
<p style="font-size: 16px; line-height: 26px; text-align: left;">
<p style="font-size: 16px; line-height: 26px; text-align: left;"><span style="font-family: comic sans ms,sans-serif; font-size: 12pt;">1. 使用 RPM 安裝檔進行轉換：</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install alien sudo alien "要轉換RPM的檔名"</pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">2. 簡單快速製作 DEB  檔的方式：</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install dh-make debhelper fakeroot devscripts checkinstall 
sudo checkinstall -D make install</pre>
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">Notes : 使用 source tarball , 執行 ./configure &amp; make , 成功  build pass 後使用</span></p>
<p><span id="more-146"></span></p>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">3. 完整製作 DEB 安裝檔的方式：</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo apt-get install dh-make debhelper fakeroot devscripts checkinstall 
mkdir -p ~/debbuild/codeant-camview/debian 
cd ~/debbuild/codeant-camview 
dch --create touch debian/control debian/rules debian/dirs</pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">changelog 內容範例，建議用 dch 產生及編輯:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;"><em>codeant-camview (2.0.1) 
unstable; urgency=low</em> <em>  
* Initial release. For network video streaming.</em> <em> 
-- CODEANT STUDIOS &lt;email@address&gt;;  Mon, 08 Jun 2015 13:50:14 +0800</em></pre>
<p><span style="font-size: 16px; line-height: 26px;">control 內容範例:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;"><em>Source: codeant-camview</em> <em>Section: graphics</em>
<em>Priority: extra</em>
<em>Maintainer: CODEANT STUDIOS &lt;email@address&gt;;</em>
<em>Build-Depends: debhelper (&gt;= 9)</em>
<em>Standards-Version: 2.0.1 Package: codeant-camview</em> 
<em>Architecture: amd64</em>
<em>Depends: 
libavcodec53 (&gt;= 4:0.8-1~) | libavcodec-extra-53 (&gt;= 4:0.8-1~),
libavutil51 (&gt;= 4:0.8-1~) | libavutil-extra-51 (&gt;= 4:0.8-1~), 
libc6 (&gt;= 2.15), libglib2.0-0 (&gt;= 2.24.0), libgtk-3-0 (&gt;= 3.0.0),
libpango1.0-0 (&gt;= 1.14.0), libpng12-0 (&gt;= 1.2.13-4), 
libportaudio2 (&gt;= 19+svn20101113), libsdl1.2debian (&gt;= 1.2.10-1),
libudev0 (&gt;= 147), libv4l-0 (&gt;= 0.5.0)</em>
<em>Description: CODEANT Video Viewer and Capturer</em>
<em> A capturing and viewing video from devices </em></pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">rules 內容範例:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;"><em>#!/usr/bin/make -f</em>
<em># -*- makefile -*-</em>
<em># Sample debian/rules that uses debhelper.</em>
<em># This file was originally written by Tsung.</em>
<em># As a special exception, when this file is copied by dh-make into a</em>
<em># dh-make output file, you may use that output file without restriction.</em>
<em># This special exception was added by Craig Small in version 0.37 of dh-make.# Uncomment this to turn on verbose mode.</em>
<em>#export DH_VERBOSE=1clean:</em>
<em>    dh_testdir</em>
<em>    dh_testroot</em>
<em>    dh_cleanbuild:</em>
<em># Nothing to dobinary: binary-arch binary-indep</em>
<em># Nothing to dobinary-arch:</em>
<em># Nothing to do#install: build</em>
<em>#    dh_testdir</em>
<em>#    dh_testroot</em>
<em>#    dh_clean -k</em>
<em>#    dh_installdirsbinary-indep:</em>
<em>    dh_testdir</em>
<em>    dh_installdirs</em> <em>    # Custom package commands</em>
<em>    cp -raf usr/* debian/tmp/usr</em> <em>    # Resuming debhelper scripts</em>
<em>    dh_testroot</em>
<em>    dh_installchangelogs</em>
<em>    dh_installdocs</em>
<em>    dh_fixperms</em>
<em>    dh_compress</em>
<em>    dh_gencontrol</em>
<em>    dh_md5sums</em>
<em>    dh_builddeb</em>
<em>.PHONY: binary binary-arch binary-indep build clean</em></pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">dirs 內容範例:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;"><em>usr/bin</em>
<em>usr/share</em>
<em>usr/lib</em></pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">Build DEB 安裝檔:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">dpkg-buildpackage -rfakeroot -b</pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">安裝套件 Install:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo dpkg -i ../codeant-camview_2.0.1_amd64.deb</pre>
<p style="text-align: left;">
<p style="text-align: left;"><span style="font-size: 16px; line-height: 26px;">移除套件 Remove:</span></p>
<pre class="prettyprint" style="font-family: 'Courier New', Courier, gMuli; font-size: 14px;">sudo dpkg -r codeant-camview</pre>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_line" href="https://www.addtoany.com/add_to/line?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="Line" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_wechat" href="https://www.addtoany.com/add_to/wechat?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="WeChat" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_sina_weibo" href="https://www.addtoany.com/add_to/sina_weibo?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="Sina Weibo" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_qzone" href="https://www.addtoany.com/add_to/qzone?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="Qzone" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&amp;linkname=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=http%3A%2F%2Fcodeant.cc%2Farchives%2F146&#038;title=%E5%A6%82%E4%BD%95%E8%A3%BD%E4%BD%9C%20Ubuntu%20DEB%20%20%E5%AE%89%E8%A3%9D%E6%AA%94" data-a2a-url="http://codeant.cc/archives/146" data-a2a-title="如何製作 Ubuntu DEB  安裝檔"></a></p><p>這篇文章 <a href="http://codeant.cc/archives/146">如何製作 Ubuntu DEB  安裝檔</a> 最早出現於 <a href="http://codeant.cc">碼蟻創研工坊 - CODEANT STUDIOS</a>。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
