發佈日期: 發佈留言

Code Snippets 筆記

Hits: 2

添加到 header.php
add_action( ‘wp_head’, function () { ?>
<?php } );

add_action( ‘wp_footer’, function () { ?>

<?php } );

add_action( ‘wp_head’, function () { ?>
// write your CSS code here
//</style><?php } );

add_shortcode( ‘ending’, function () {
//php code
} );

add_action( ‘after_setup_theme’, function() {
//php code

加入你的 wp-config.php 檔案
define (‘EMPTY_TRASH_DAYS’, 7);清空回收桶
define (‘EMPTY_TRASH_DAYS’, 0);停用回收桶
define( ‘WP_POST_REVISIONS’, 3 );減少文章版本
define( ‘WP_POST_REVISIONS’, false );停用文章版本功能
define( ‘AUTOSAVE_INTERVAL’, 60 ); // 秒自動儲存你的文章和頁面
define( ‘WP_DEBUG’, true );開啟 PHP 除錯工具
define( ‘SCRIPT_DEBUG’, true ); 開啟 CSS 和 JavaScript 除錯工具
define(‘WP_SITEURL’, ‘http://www.chungg.com’);指定網站網址
define(‘WP_HOME’, ‘http://www.chungg.com/wordpress’);指定 WordPress 網址(安裝目錄)
define( ‘WP_CACHE’, true );啟用 WP 快取
define( ‘WP_ALLOW_MULTISITE’, true );啟用 WordPress 多網站
define( ‘NOBLOGREDIRECT’, ‘http://www.chungg.com’ );重新導向不存在的子網域和子目錄
define( ‘WP_ALLOW_REPAIR’, true );啟用內建資料庫最佳化功能
define( ‘AUTOMATIC_UPDATER_DISABLED’, true );停用所有自動更新
define( ‘WP_AUTO_UPDATE_CORE’, false );停用所有核心更新
define( ‘WP_AUTO_UPDATE_CORE’, true );啟用所有核心更新,包括跨版本更新及主要更新
define( ‘WP_AUTO_UPDATE_CORE’, ‘minor’ );啟用核心更新,但只針對安全性更新(預設)
define( ‘WP_MEMORY_LIMIT’, ’96M’ );為網站設定記憶體限制
define( ‘WP_MAX_MEMORY_LIMIT’, ‘128M’ );為控制台設定記憶體限制
define( ‘FORCE_SSL_ADMIN’, true );強制 SSL 模式登入
define( ‘DISALLOW_FILE_EDIT’, true );停用外掛和佈景主題編輯器
define( ‘DISALLOW_FILE_MODS’, true );停用外掛和佈景主題編輯器,加上外掛和佈景主題更新,所以如果你啟用這項設定,就不用再額外加入 DISALLOW_FILE_EDIT。
define( ‘IMAGE_EDIT_OVERWRITE’, true );清理圖片編輯
define( ‘DISALLOW_UNFILTERED_HTML’, true );禁止編審和系統管理員使用未篩選的 HTML

將 wp-content 目錄移動到其他路徑
define( ‘WP_CONTENT_DIR’, dirname(__FILE__) . ‘/new/wp-content’ );
或define( ‘WP_CONTENT_URL’, ‘https://www.chungg.com/new/wp-content’ );
重新命名你的 wp-content 目錄:define (‘WP_CONTENT_FOLDERNAME’, ‘newfoldername’);並非 100% 可行,因為很多 WordPress 外掛開發者已將 “wp-content” 路徑寫死在外掛的程式碼裡。

加入佈景主題的 functions.php 檔

add_filter( ‘author_link’, ‘my_author_link’ );
function my_author_link() {
return home_url( ‘about’ );

add_action(‘template_redirect’, ‘redirect_single_post’);
function redirect_single_post() {
if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1 && $wp_query->max_num_pages == 1) {
wp_redirect( get_permalink( $wp_query->posts[‘0’]->ID ) );

將頁面從 WordPress 搜尋結果排除
function filter_search($query) {
if ($query->is_search) {
$query->set(‘post_type’, ‘post’);
return $query;
add_filter(‘pre_get_posts’, ‘filter_search’);

function remove_comment_fields($fields) {
return $fields;

add_filter( ‘preprocess_comment’, ‘minimal_comment_length’ );
function minimal_comment_length( $commentdata ) {
$minimalCommentLength = 20;
if ( strlen( trim( $commentdata[‘comment_content’] ) ) < $minimalCommentLength ){
wp_die( ‘所有留言必須大於 ‘ . $minimalCommentLength . ‘ 個字元長度。’ );
return $commentdata;

發佈日期: 發佈留言


Hits: 8

Apache2|Nginx + PHP + Linux Shell Scripts


(2).監測運作 PORT埠,背景色就是最後的狀態。

Linux Shell Scripts 程式碼內容


# 用日期為檔名一部份
fday=`date +%Y-%m`
runtime=`date +%H-%M`

  for svip in $serverip
    chkip1=`telnet "$svip" 80 <<!
    if [ "`echo -e $chkip1 | awk '{print $4}'`" == "to" ]; then
      echo -e $chkip1 | awk '{print $4 " =OK"}'
      echo "`date '+%Y-%m-%d %H:%M:%S'` $svip OK" >> /XXX_CKLOG/"$fday".log
      # 再測一次 sleep 1或3秒      
      echo -e $chkip1 | awk '{print $4 " =NG1"}'
      sleep 1
      chkip2=`telnet "$svip" 80 <<!
      if [ "`echo -e $chkip2 | awk '{print $4}'`" == "to" ]; then
        echo -e $chkip2 | awk '{print $4 " =OK"}'
        echo "`date '+%Y-%m-%d %H:%M:%S'` $svip OK" >> /XXX_CKLOG/"$fday".log
        echo -e $chkip2 | awk '{print $4 " =NG2"}'
#       echo "`date '+%Y-%m-%d %H:%M:%S'` httpd on $svip - - - Failed!!" | mail -s $runtime" XXX Server Check: httpd failed." chungg.lin@gmail.com
        echo "`date '+%Y-%m-%d %H:%M:%S'` $svip NG" >> /XXX_CKLOG/"$fday".log


XXXX年-XX月.log 記錄檔案內容

2011-08-25 00:04:28 XXX.net OK
2012-08-25 00:14:26 XXX.net OK
2013-08-25 00:24:29 XXX.net OK
2014-08-25 00:34:27 XXX.net OK
2015-08-25 00:44:28 XXX.net OK
2016-08-25 00:54:31 XXX.net NG
2017-08-25 01:04:29 XXX.net NG
2018-08-25 01:14:25 XXX.net OK
2019-08-25 01:24:25 XXX.net OK
2020-08-25 01:34:27 XXX.net OK
2021-08-25 01:44:23 XXX.net OK
2022-08-25 01:54:23 XXX.net OK

發佈日期: 發佈留言


Hits: 11

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

550-5.7.26 message has been blocked. Please visit
550-5.7.26 https://support.google.com/mail/answer/81126#authentication for more
550 5.7.26 information. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.154 – gsmtp

找了很多網路文章,大致可以知道 可能是被認為不信任主機又太頻繁寄信了,所以被擋掉。

2.在 https://postmaster.google.com 加入被擋的網域(當然這個網域是自己的 chungg.com)!
3.在DNS加一個SPF的TXT記錄:v=spf1 a mx ptr include:_spf.google.com ~all!

利用這個網站 https://toolbox.googleapps.com/apps/checkmx/ 檢查一下,還有三個驚嘆號
⚠ 尚未設定 DKIM。
⚠ 尚未設定 DMARC。
⚠ 找不到 Google 的郵件收發伺服器。要轉送主機設定嗎?



Hits: 2

This is a sample page.


Our refund and returns policy lasts 30 days. If 30 days have passed since your purchase, we can’t offer you a full refund or exchange.

To be eligible for a return, your item must be unused and in the same condition that you received it. It must also be in the original packaging.

Several types of goods are exempt from being returned. Perishable goods such as food, flowers, newspapers or magazines cannot be returned. We also do not accept products that are intimate or sanitary goods, hazardous materials, or flammable liquids or gases.

Additional non-returnable items:

  • Gift cards
  • Downloadable software products
  • Some health and personal care items

To complete your return, we require a receipt or proof of purchase.

Please do not send your purchase back to the manufacturer.

There are certain situations where only partial refunds are granted:

  • Book with obvious signs of use
  • CD, DVD, VHS tape, software, video game, cassette tape, or vinyl record that has been opened.
  • Any item not in its original condition, is damaged or missing parts for reasons not due to our error.
  • Any item that is returned more than 30 days after delivery


Once your return is received and inspected, we will send you an email to notify you that we have received your returned item. We will also notify you of the approval or rejection of your refund.

If you are approved, then your refund will be processed, and a credit will automatically be applied to your credit card or original method of payment, within a certain amount of days.

Late or missing refunds

If you haven’t received a refund yet, first check your bank account again.

Then contact your credit card company, it may take some time before your refund is officially posted.

Next contact your bank. There is often some processing time before a refund is posted.

If you’ve done all of this and you still have not received your refund yet, please contact us at {email address}.

Sale items

Only regular priced items may be refunded. Sale items cannot be refunded.


We only replace items if they are defective or damaged. If you need to exchange it for the same item, send us an email at {email address} and send your item to: {physical address}.


If the item was marked as a gift when purchased and shipped directly to you, you’ll receive a gift credit for the value of your return. Once the returned item is received, a gift certificate will be mailed to you.

If the item wasn’t marked as a gift when purchased, or the gift giver had the order shipped to themselves to give to you later, we will send a refund to the gift giver and they will find out about your return.

Shipping returns

To return your product, you should mail your product to: {physical address}.

You will be responsible for paying for your own shipping costs for returning your item. Shipping costs are non-refundable. If you receive a refund, the cost of return shipping will be deducted from your refund.

Depending on where you live, the time it may take for your exchanged product to reach you may vary.

If you are returning more expensive items, you may consider using a trackable shipping service or purchasing shipping insurance. We don’t guarantee that we will receive your returned item.

Need help?

Contact us at {email} for questions related to refunds and returns.

OpenMediaVault OMV

Hits: 127

OpenMediaVault 簡稱 OMV

OpenMediaVault 是一套基於 Debian Linux 的網路儲存系統(Network Attached Storage,NAS);OpenMediaVault 是一套相當棒的免費網路儲存系統,有直覺式的多國語言管理介面,並支援各種網路通訊協定的存取方式的服務整合與儲存管理功能,也有系統檢測功能、郵件警示通知、系統日誌檢視、各項服務運作檢視、連線工作階段檢視以及各項系統資源即時負載檢視,此外,OMV也提供外掛插件(Plug-in)的整合功能,例如:iSCSI Target、LDAP驗證、防毒軟體等等,來延伸儲存系統的存取能力以及強化安全的防護,讓使用者無論是在企業內部還是外部,都可以依據權限的配置,隨時隨地上傳或下載檔案,可作為個人企業私有雲儲存管理系統。


我的 Linux 學習起源自 B2D OB2D ,B2D 的本意是 Back to Debian,取 字首 B、to 的諧音 2、字首 D 三者而成,主要,是希望大家能多多使用 Debian Linux 的意思。
Debian Linux 入門不易,但它是一個組織龐大而且嚴謹的套件,和 CentOS 都是公認的最適合用於伺服器的作業系統,比其它都要穩定,甚至可以說是穩定得無與倫比,只要應用層面不缺陷,系統基本上固若金湯,可以常年工作不用重啟,穩定性極強,所以非常推薦使用 Debian。


綱路上有很多安裝教學,我這就不在教了,請自行網上找找: 免費打造NAS儲存環境、實戰建置OpenMediaVault、自己DIY一個NAS吧!、用5000元預算架設NAS、….等等等等等的有一堆。以下是我的重點筆記。

在 Intel® NUC 上使用嵌入式多媒體卡(eMMC)儲存裝置。

NUC出廠規格:Intel NUC BOXNUC7CJYSAMN1(J4005/4G/Win10)
NUC改後規格:Intel NUC BOXNUC7CJYSAMN1(J4005/MAX:8G/OMV5/+2.5吋企業硬碟)
NUC出廠規格:Genuine捷元 Mini PC 客製化迷你電腦! (採用Intel® NUC 原廠套件)
◆Intel® 第10代(i3-10110U/i5-10210U/i7-10710U)
◆最高雙碟:PCIe M.2 + 2.5″硬碟(選購)
◆Windwos 10 Home/PRO
◆最高雙碟:PCIe M.2 + 2.5″企業硬碟
◆OpenMediaVault OMV5(以上)NAS系統

☑apt-cache show openmediavault* | grep Package: > apt-cache.txt
Package: openmediavault
Package: openmediavault-unionfilesystems
Package: openmediavault-anacron
Package: openmediavault-aoe
*Package: openmediavault-apttool
Package: openmediavault-autoshutdown
Package: openmediavault-backup
Package: openmediavault-borgbackup
Package: openmediavault-downloader
*Package: openmediavault-fail2ban
Package: openmediavault-flashmemory
Package: openmediavault-kvm
Package: openmediavault-kvm
*Package: openmediavault-locate
Package: openmediavault-luksencryption
Package: openmediavault-mergerfsfolders
Package: openmediavault-minidlna
Package: openmediavault-nilfs2
*Package: openmediavault-omvextrasorg
Package: openmediavault-omvextrasorg
Package: openmediavault-openvpn
Package: openmediavault-remotemount
*Package: openmediavault-resetperms
Package: openmediavault-rsnapshot
Package: openmediavault-sftp
Package: openmediavault-snapraid
*Package: openmediavault-symlinks
Package: openmediavault-teamviewerhost
Package: openmediavault-tgt
Package: openmediavault-wakealarm
Package: openmediavault-wol
Package: openmediavault-zfs
*Package: openmediavault-clamav
*Package: openmediavault-diskstats
Package: openmediavault-forkeddaapd
Package: openmediavault-keyring
Package: openmediavault-lvm2
Package: openmediavault-nut
Package: openmediavault-shairport
Package: openmediavault-sharerootfs
Package: openmediavault-snmp
Package: openmediavault-tftp
Package: openmediavault-usbbackup

[FT-1000BS] driver = nutdrv_qx

☑apt install net-tools
☑apt-get install openmediavault-apttool openmediavault-clamav openmediavault-diskstats openmediavault-fail2ban openmediavault-locate openmediavault-resetperms openmediavault-symlinks

☑wget http://prdownloads.sourceforge.net/webadmin/webmin_1.983_all.deb
☑apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python unzip shared-mime-info -y
☑dpkg –install webmin_1.983_all.deb

OMV 6 單顆硬碟當系統碟也當資料碟


發佈日期: 發佈留言

用WIN10+BIND9 架設 DDNS Server

Hits: 552

Bind是用來解決網域名稱與IP位址對應的軟體,且是個被廣泛使用的DNS伺服器軟體,它提供了強大及穩定的名稱服務,因此有近九成的DNS伺服器主機都是使用Bind。目前最新的版本到Bind 9。 DNS 主流之一個是 BIND (ISC), 雖有一些複雜性,但效果非常好,能承受大量查詢。

= = = 重點筆記,僅參考不一定正確 = = =

# 檔案: D:\ISC BIND 9\etc\named.conf
… 略 …
zone “test.chungg.com” {
type master;
file “test.chungg.com”;
allow-update {;}; # 開放 進行動態更新
## allow-transfer { slave_ip;;}; # slave 主機,可能一部或多部,若無請寫 none
allow-transfer { none; };

# nsupdate 指令
>zone test.chungg.com
>update delete user1.test.chungg.com
>update add user1.test.chungg.com 6000 A XXX.XXX.XXX.XXX

進行了 nsupdate 的操作,則在目錄 D:\ISC BIND 9\etc\ 將會產生一日誌檔 zone_name.jnl
jnl 檔是不能隨便刪除,因為它等於是 test.chungg.com 的補充資料,而這些補充資料在 DNS reload/restart 時, named 還會在把它讀進來,所以動態更新後的資料,並不會隨著 dns 重啟後而消失,如果你想讓現在整個 zone 檔出現所有的記錄,那可以 rndc stop 來停止。

新發現 ISC BIND 9.18 版本將不支持 Windows 平台,最後可能能跑的版本是 9.17.14[15]
詳情請看原站: https://www.isc.org/blogs/bind-update-summer2021/
[Remove support for the Windows environment]

CVE-2022 安全漏洞更新資訊
CVE-2022-3488:在處理迭代查詢的重複響應中的ECS選項時,BIND 受支持的預覽版本named可能異常終止。
CVE-2022-3924:named 被配置為從陳舊緩存中應答,可能在遞歸客戶端彈性配額時異常終止。

重裝後,發現 WIN10-PRO x64(22H2) 可以成功的版本是: BIND9.17.12.x64.zip.
再新一點的,起動就會出現提示1067錯誤訊息,我用的都是原來的etc配置文件復原,就算重新初始化(rndc-confgen.exe -a)、修改文件系統權限都沒有用,對於出現這個錯誤目前無解。

發佈日期: 發佈留言

Roundcube 錯誤問題解決 筆記

Hits: 51

Q:Roundcube 無法刪除郵件錯誤,服務器錯誤 UID COPY: The folder could not be found。
A:需要在設置-文件夾管理裡建一個文件夾。然後在設置-選項-自定義文件夾裡 把「已刪除郵件」這一項選中剛才新建的文件夾。或者不新建也行,直接選已有文件夾。

發佈日期: 發佈留言


Hits: 5

There are no links pointed at your website.
沒有外連結連向您的網頁嗎? 歡迎交換唷!

錦隆紙品有限公司 https://jinlong.bonkids.net
萬邦熱能工業股份有限公司 https://www.uciburner.com.tw
富王建材有限公司 https://www.fuown.com.tw
修霆資訊行 https://www.xiutingpc.com

發佈日期: 發佈留言

為了安全性考量,Firefox 已經取消連線要求。

Hits: 615

此網址所用的通訊埠 (Port) 通常不是用於網路瀏覽。為了安全性考量,Firefox 已經取消連線要求。

The communication port used for this URL is usually not used for network browsing. For security reasons, Firefox has canceled the online request.


發佈日期: 發佈留言


Hits: 1514

如果你是Windows 8/10,在BIOS中設定了RTC (Real-time clock)自動喚醒,但是遇到了狀況-設定好了時間他就是不開機!! 那應該是:

一、由於RTC Wake up的先決條件是你的Windows有真的關機,他才能被自動喚醒,如果只是休眠、待命的假性關機,那自動喚醒就不會達到條件,自然就無法啟動,而在Windows 8以後的版本都支援了一個叫快速啟動的功能,預設是啟用的,這個快速啟動為了能達成目標,他的做法就是讓你的電腦進入另外一種類似休眠的低電壓待命狀態,也就是他並沒有完全的關機~


二、在Bios裡面尋找關鍵字叫做 Eup,(Energy Using Product) 或 Erp,(Energy-related Products) 設定成 關閉(Disabled)



The setting of Power On By RTC https://www.asus.com/support/FAQ/1031562/