helloworld

https://im.qq.com/linuxqq/
雖然還是 beta 版本,今年的四月有最新的更新也算是有誠意了
image

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

節錄博客來facebook粉絲頁
中衛醫療口罩第二波資訊更正:
1. 6月9號早上11點限量開賣
2. 預計販售軍綠、薰衣紫、深丹寧三色平面口罩
3. 每盒50片售價$300,每ID每個顏色限購1盒
4. 放入購物車不代表取得購買資格,數量有限

undefined undefined
undefined


詳情依博客來網頁公告為準

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

有些時候可能需要調整mysql 原來的編碼,以達到預期的功能
如為了要存放emoji icon時

1. 修改 my.cnf 預設值
[client]
default-character-set=utf8mb4

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci

2. 修改已經存在的 database 預設值
ALTER DATABASE `example_db` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

3. 修改已經存在的 table 預設值
ALTER TABLE `example_db`.`example_table` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ;
但上面這串語法,只會改變table 的預設值,對於已經存在的欄位編碼不會調整

4. 如果要變更欄位編碼,需要再下以下的sql 語法
ALTER TABLE `example_db`.`example_table` MODIFY `example_col` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
或是
ALTER TABLE ``example_db`.`example_table` CHANGE `example_col` `example_col` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 

5. 如果想要table,column 都一起被調整 (強烈建議)
可以直接執行以下語法
ALTER TABLE `example_db`.`example_table` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

 


undefined

 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

預設google bot 或是spider 會根據你的網站效能來評估抓取網站內容的頻率
但是如果你的網站真的已經被爬到吃不消
或是流量費超支
或是後端有其他瓶頸,google 也無從得知

這時候可以透過 google search console 暫時限制 google bot 爬網頁的頻率
進入
https://www.google.com/webmasters/tools/settings
image

請選取資源
image

選擇 限制 Google 的檢索頻率上限
並調整到一個適合的檢索頻率
image

儲存

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

活動預告 5/21 無印良品不限金額結帳81折
undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

以下是各大瀏覽器的錯誤訊息 

[IE]
此內容無法在框架中顯示
為了協助保護您在此網站所輸入的資訊安全性,此內容的發行者不允許在框架中顯示資訊。
您可以嘗試的方式:
在新視窗中開啟此內容  
image

[Firefox]
因 X-Frame-Options 封鎖
連線到 example.com 時發生錯誤。
因為這個頁面包含 X-Frame-Options 政策,不允許以這種方式載入,Firefox 封鎖了這個頁面載入。
image

[google chrome]
Refused to display 'https://example.com/xxx.html' in a frame because it set 'X-Frame-Options' to 'deny'.
image

如果你有iframe 中網址的管理權限
請檢察apache 設定檔是否有以下設定
Header always set X-Frame-Options "xxx"

設定這個參數可以防止你的網站被攻擊
有三種設定值
1. DENY
不允許插入iframe 中

2. SAMEORIGIN
只允許插入同一個域名的網頁iframe中

3. ALLOW-FROM uri
只能插入指定的域名中
如: X-Frame-Options: ALLOW-FROM https://helloworld.pixnet.net/

undefined

 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

首先到ga首頁 https://analytics.google.com/
為你的blog 申請一個ga code
系統會自動幫你生成一段java script
你可以選擇將這段script 貼在某個側邊欄中
但是可能會改壞,可能手機版頁面不會載入這個側邊攔

建議的做法
到痞客幫應用市集 https://appmarket.pixnet.tw/
下載安裝Google數據分析
image

並設定事前已經申請好的ga code
image

格式應該是 UA-123456789-0 
image

如果你的網站持續有流量的話
在 google analytics 管理頁面中應該可以看到數據產生
image

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

博客來 2020 一人衣愛助兒盟

2020愛T恤 | 一人衣愛助兒盟12周年 贈原燒350元愛心折抵券乙張

undefined

認購2020愛T恤349元送原燒350元折抵券
6/30前到店使用再贈廣島牡蠣
由「拾蒔生活製作所」插畫家李伊甯設計
愛心大使林柏宏邀您一起響應公益
一人衣愛助兒盟!

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果你是用gmail 當MUA, 也就是利用gmail 來收發外部的郵件
最近在寄信時出現這個錯誤訊息

郵件未傳送
你已設定使用「以這個地址寄送郵件」功能,透過其他電子郵件地址或別名傳送這封郵件。不過,該地址所屬帳戶的設定錯誤或已失效。請檢查相關設定,然後再嘗試重新傳送。
瞭解詳情
伺服器的回應如下:
TLS Negotiation failed, the certificate doesn't match the host.
image

以postfix + comodo wildcard ssl 為例
1. 取得合法的 ssl 憑證
免費或是購買1~2年憑證 (略)

2. 合併ca憑證
# cd /ssldir/example.com/
# cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ca-bundle.crt


3. 修改 postfix main.cf
# vi /usr/local/etc/postfix/main.cf
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /ssldir/example.com/example.com.key
smtpd_tls_cert_file = /ssldir/example.com/STAR_example_com.crt
smtpd_tls_CAfile = /ssldir/example.com/ca-bundle.crt
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

4. 重啟 postfix 服務
# /usr/local/etc/rc.d/postfix restart

5. 測試
# openssl s_client -connect mail.example.com:25 -starttls smtp
觀察 Certificate chain 是否有噴錯誤訊息,如果都正常的話,就開開心心的寄一封信到別的網域測試看看吧
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

dell r310 server 如果無法利用usb 隨身碟開機的話
請在開機時按F12 進入BIOS 設定畫面

1. 在開機設定的地方確認 Hard drive C: 是否已勾選
image

2. 按+ 將usb 開機順序移到內接硬碟/raidcard 前
image

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果要把一個已經有加入密碼的PDF 文件轉給他人,但又不想提供密碼
可以善用 google chrome 瀏覽器
說穿了也不是把密碼移除,而是另存一份沒有密碼的版本
前提是你自己知道這個pdf 的文件的密碼

1. 首先用 Google Chrome 開啟有加密碼的PDF 文件
2. 列印 -> 目的地 -> 另存為 PDF -> 儲存

image

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

因為 Linode 政策關係,2019 年底後註冊的新使用者
預設對外不開放 tcp 25 468 587 port
也就是不能收發郵件
目的是為了要減少spam 

但新用戶也不用擔心,租了卻不能發信
只要按照以下步驟
還是可以收發信的
1. 在 DNS server 上設定該台 linode 的正解 A 紀錄
2. 在 linode 管理介面設定相對應的反解紀錄
http://blog.sina.com.tw/helloworld/article.php?entryid=695484

3. 開 tickets 說這台linode 有寄信的需求

原則上只要你設定正確,很快就會幫你開通了

參考資料
https://www.linode.com/2019/11/05/a-new-policy-to-help-fight-spam/

https://www.linode.com/docs/email/running-a-mail-server/#sending-email-on-linode
 

【午茶夫人】微糖金鑽鳳梨乾-100g/袋

 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

因為疫情關係
很多公司行號都在演練異地或是居家辦公,WFH (work from home)

vpn 是一個方式
但如果已經習慣辦公場所的電腦環境
沒有他不行的話

現有遠端連現有幾個方式可以使用
可以使用商業軟體如 team viewer
team viewer 的好處是
可以不受防火牆限制
dhcp client 也不用特別去記目前的ip

windows 有內建的 remote desktop 
可以讓其他 windows 用戶連線到遠端主機的桌面
甚至是 iphone 和 mac os 也可以下載 app 連線到 windows remote desktop
https://apps.apple.com/tw/app/remote-desktop-mobile/id714464092

而 Mac OS 內建也有類似的設定

server 端
1. 系統偏好設定 -> 共享
image

2. 開啟螢幕共享 -> 桉 + 號 允許下列使用者存取
image

client 端
1. 前往  -> 連接伺服器
image

2. 輸入 vnc://IP:5900 , 連線即可
image

如果 client 是 windows 環境也可以下載 vnc viewer 連線
https://www.realvnc.com/en/connect/download/viewer/

undefined

文章標籤

helloworld 發表在 痞客邦 留言(1) 人氣()

$ sudo dnf install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
$ sudo dnf module disable mysql
$ sudo percona-release setup pxc57
$ sudo dnf install Percona-XtraDB-Cluster-57

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果在 CentOS + apache + php 的環境下面出現 Warning: file_get_contents(http://xxx): failed to open stream: Permission denied in xxx
或是一些摸不著頭緒的錯誤訊息

當確定程式沒有問題,在其他設備上也可以正常執行
請檢察看看 selinux 的設定
最簡單的方式就是 修改 /etc/selinux/config
SELINUX=disabled
重開機

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

今天發現 Percona XtraDB Cluster 一個node掛掉,準備要把程式切到另一個正常node 的時候
連線到資料庫時出現這個錯誤

WSREP has not yet prepared node for application use

解決方式
登入mysql 後
mysql> SET GLOBAL wsrep_provider_options='pc.bootstrap=YES';
Query OK, 0 rows affected (0.00 sec)

即可

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

20200120 20200120 今日花況
過年期間可以來賞花

 

IMG_1199

IMG_1200

IMG_1201

IMG_1202

IMG_1203

IMG_1204

IMG_1205

IMG_1189

IMG_1190

IMG_1191

IMG_1192

IMG_1193

IMG_1194

IMG_1195

IMG_1196

IMG_1197

undefined

一年四季賞花輕旅行:邂逅臺灣之美,花現四季繽紛色彩

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

根據網路上的說法
Bytespider 是字節跳動旗下的今日頭條正在開發搜索引擎所派出來的爬蟲
但頻率真的太高了
有些小網站根本受不了
如果要擋的話有幾個方式

1. robots.txt
不允許 Bytespider 來爬網站,但可能不會有效

2. apache rewrite rule 
判斷 agent 為 Bytespider 則回應 403

3. 防火牆直接擋在外面
這是最直接有效的方式,也不用讓人家進到web server 後再給人家拒絕
目前整理出來幾個網段可以參考
110.249.202.0/24
110.249.201.0/24
111.225.149.0/24
111.225.148.0/24
60.8.123.0/24
220.243.135.0/24
220.243.136.0/24
 

helloworld 發表在 痞客邦 留言(0) 人氣()

準備啟動第二個node 要加入 perconaxtradb cluter 中
但是啟動失敗
看一下 /var/log/mysqld.log
[ERROR] WSREP: Command did not run: wsrep_sst_xtrabackup-v2 --role 'donor' --address ' :4444/xtrabackup_sst//1' --socket '/var/lib/mysql/mysql.sock' --datadir '/home/mysql' --defaults-file '/etc/my.cnf' --defaults-group-suffix '' --mysqld-version '5.7.28-31-57'   '' --gtid 'xxxx'

暫時的解法,把 wsrep_sst_method 由 xtrabackup-v2 改成 rsync
vi /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
# SST method
#wsrep_sst_method=xtrabackup-v2
wsrep_sst_method=rsync

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

> use mydb
switched to db mydb
> db.getCollection('mycollection').find({}).count()
53637
>

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

varnish 預設使用 regular expression 比對字串是有區分大小寫的
如 

if (req.http.User-Agent ~ "spider") {
    return (synth(403));
}

如果要不分大小寫比對字串時,可以在字串前面加入 (?i) 

if (req.http.User-Agent ~ "(?i)spider") {
    return (synth(403));
}
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

隨著顯卡和螢幕解析度大幅提高後
如果發現部分程式的顯示畫面或是文字模糊不清
可以嘗試以下方式解決,或許有機會可以解決

選取應用程式,點擊右鍵 -> 內容 -> 相容性 變更高DPI設定 將以下兩個checkbox 都勾選起來 確定離開

image

重新開啟應用程式看看顯示情形是否有改善

undefined

 

helloworld 發表在 痞客邦 留言(0) 人氣()

在 shell 下如果要用curl 指定IP抓取 virtual host 網頁內容可以用以下指令
# curl 'http://192.168.5.111/path/pagename' -H "Host: example.pass.tw"

相對於以上指令,如果要用php 執行的話
<?php
$ch = curl_init('http://192.168.5.111/path/pagename');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: example.pass.tw'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

AWStats 是一套強大的 opensource log 分析工具
可以分析來自 web , mail , ftp server 等格式的紀錄

以下測試環境:
FreeBSD 12.1-RELEASE
apache24/httpd-2.4.41
awstats-7.7

更新ports
# portsnap fetch update

安裝 apache24
# cd /usr/ports/www/apache24/
# make install clean

接下來安裝 AWStats
# cd /usr/ports/www/awstats/
# make install clean

設定apache, 將以下註解拿掉
# cd /usr/local/etc/apache24/
# vi httpd.conf
LoadModule cgid_module libexec/apache24/mod_cgid.so

設定vhost , 如果這台是單一功能的機器也可以直接寫在 httpd.conf 內
# cd /usr/local/etc/apache24/Includes/
# vi awstats.conf
<VirtualHost *:80>
        ServerAdmin webadm@staff.pass.tw
        ServerName awstats.pass.tw
        ErrorLog /home/archive/logs/error_log-awstats.log
        CustomLog /home/archive/logs/access_log-awstats.log combined

        Alias /awstatsclasses "/usr/local/www/awstats/classes/"
        Alias /awstatscss "/usr/local/www/awstats/css/"
        Alias /awstatsicons "/usr/local/www/awstats/icon/"
        ScriptAlias /awstats/ "/usr/local/www/awstats/cgi-bin/"

        <Directory "/usr/local/www/awstats/">
                Options None
                AllowOverride None
                Require all granted
        </Directory>
        <Directory "/usr/local/www/awstats/cgi-bin/">
                Options ExecCGI
                SetHandler cgi-script
        </Directory>
</VirtualHost>

重新啟動apache
# apachectl restart

編輯設定檔,簡單調整適合自己的設定
# cd /usr/local/www/awstats/cgi-bin/
# cp awstats.model.conf awstats.pass.tw.conf
# vi awstats.pass.tw.conf
LogFile="gzip -cd /home/workdir/access_log.pass.tw*.gz |"
LogType=W
LogFormat=1
LogSeparator=" "
SiteDomain="books.pass.tw"
DirData="/usr/local/www/awstats/data"

開始分析數據
# mkdir /usr/local/www/awstats/data
# /usr/local/www/awstats/cgi-bin/awstats.pl -config=pass.tw -update

打開瀏覽器,網址輸入
http://主機名稱或ip/awstats/awstats.pl?config=設定檔

http://awstats.pass.tw/awstats/awstats.pl?config=pass.tw

測試如果正常的話,將 /usr/local/www/awstats/cgi-bin/awstats.pl 寫入 crontab 每日固定時間執行即可

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

FreeBSD 安裝 AWStats

AWStats 是一套強大的 opensource log 分析工具
可以分析來自 web , mail , ftp server 等格式的紀錄

以下測試環境:
FreeBSD 12.1-RELEASE
apache24/httpd-2.4.41
awstats-7.7

更新ports
# portsnap fetch update

安裝 apache24
# cd /usr/ports/www/apache24/
# make install clean

接下來安裝 AWStats
# cd /usr/ports/www/awstats/
# make install clean

設定apache, 將以下註解拿掉
# cd /usr/local/etc/apache24/
# vi httpd.conf
LoadModule cgid_module libexec/apache24/mod_cgid.so

設定vhost , 如果這台是單一功能的機器也可以直接寫在 httpd.conf 內
# cd /usr/local/etc/apache24/Includes/
# vi awstats.conf
<VirtualHost *:80>
        ServerAdmin webadm@staff.pass.tw
        ServerName awstats.pass.tw
        ErrorLog /home/archive/logs/error_log-awstats.log
        CustomLog /home/archive/logs/access_log-awstats.log combined

        Alias /awstatsclasses "/usr/local/www/awstats/classes/"
        Alias /awstatscss "/usr/local/www/awstats/css/"
        Alias /awstatsicons "/usr/local/www/awstats/icon/"
        ScriptAlias /awstats/ "/usr/local/www/awstats/cgi-bin/"

        <Directory "/usr/local/www/awstats/">
                Options None
                AllowOverride None
                Require all granted
        </Directory>
        <Directory "/usr/local/www/awstats/cgi-bin/">
                Options ExecCGI
                SetHandler cgi-script
        </Directory>
</VirtualHost>

重新啟動apache
# apachectl restart

編輯設定檔,簡單調整適合自己的設定
# cd /usr/local/www/awstats/cgi-bin/
# cp awstats.model.conf awstats.pass.tw.conf
# vi awstats.pass.tw.conf
LogFile="gzip -cd /home/workdir/access_log.pass.tw*.gz |"
LogType=W
LogFormat=1
LogSeparator=" "
SiteDomain="books.pass.tw"
DirData="/usr/local/www/awstats/data"

開始分析數據
# mkdir /usr/local/www/awstats/data
# /usr/local/www/awstats/cgi-bin/awstats.pl -config=pass.tw -update

打開瀏覽器,網址輸入
http://主機名稱或ip/awstats/awstats.pl?config=設定檔

http://awstats.pass.tw/awstats/awstats.pl?config=pass.tw

測試如果正常的話,將 /usr/local/www/awstats/cgi-bin/awstats.pl 寫入 crontab 每日固定時間執行即可

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

目前幾乎所有的瀏覽器都已支援壓縮功能
以下幾個網站可以方便檢測你的網站是否有開啟壓縮的功能
https://aruljohn.com/gziptest.php
https://www.whatsmyip.org/http-compression-test/
http://www.gidnetwork.com/tools/gzip-test.php

操作方式都一樣,只需輸入網址就可以方便知道結果


undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

情境
example.com/a/test.html -> a.example.com/test.html
example.com/b/test.html -> b.example.com/test.html

# vi /etc/varnish/default.vcl
 

vcl 4.0;

import directors;
import std;

[.... 中間略 ....]

sub vcl_recv {
    if (req.http.host ~ "example.com") {
        if (req.url ~ "^/a/") {
            set req.url = regsub(req.url, "^/a","");
            set req.http.host = "a.example.com";
            set req.backend_hint = a.backend();
        } else if (req.url ~ "^/b/") {
            set req.url = regsub(req.url, "^/b","");
            set req.http.host = "b.example.com";
            set req.backend_hint = b.backend();
        }
    }
}

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

我們可能會遇到系統硬體不夠力,想要換一台新的NAS
或是空間不族,想要更換大一點的硬碟空間

首先除了先要把裡面的資料備份出來外
如果原來的設定很單純的話,當然可以直接在新機器上面設定
但是如果裡面很多的服務和帳號的話,建議還是用系統提供的備份還原機制

控制台 -> 更新 & 還原 -> 系統設定備份

1. 備份設定
系統會將以下的設定及帳號密碼備份出來一個 .dss 的檔案

2. 還原設定
(1) 選擇要還原哪一個備份檔

(2) 選擇要還原的設定及是否要覆寫衝突
如果是全新的設定的話,當然是全選
但是如果只是單純因為前一刻手誤,不小心改壞設定或是誤刪帳號,就可以選擇各別的設定還原






PS. 還原設定的時候不會異動到網路設定,所以可以不用擔心新舊兩台機器會有IP 衝突的狀況
 

undefined

 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

測試Synology DS413 可以抓到單顆10TB硬碟
但是這個型號的NAS 每個 volume 的上限是 16TB
所以裝 10TB的硬碟很尷尬
做成 raid10 / raid5 / raid6 都會超過 16TB
只能做成兩個raid1 的 volume



官方資料
https://www.synology.com/zh-tw/knowledgebase/DSM/tutorial/Storage/Why_does_my_Synology_NAS_have_a_single_volume_size_limitation

因應現在硬碟空間愈做愈大,建議就買可以上到108TB 的機型

undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

手頭上剛好有 Dell R310 和 4顆SEAGATE 10TB的硬碟
想要來試試可不可以用舊機器裝一台空間大一點的NAS

進到 Raid BIOS , 很順利的抓到10TB的硬碟
也可以成功建立 Raid 5 && Virtual Disk

但進到CentOS 8 的安裝介面的時候,看不到剛剛建立的 Virtual Disk

結論: 失敗,冏
undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

Close

您尚未登入,將以訪客身份留言。亦可以上方服務帳號登入留言

請輸入暱稱 ( 最多顯示 6 個中文字元 )

請輸入標題 ( 最多顯示 9 個中文字元 )

請輸入內容 ( 最多 140 個中文字元 )

reload

請輸入左方認證碼:

看不懂,換張圖

請輸入驗證碼