2018年2月24日 星期六

XAMPP 更新...

修正httpd.conf下列內容:

  1.  取消目錄瀏覽
  2. 將logs定時roration

取消目錄瀏覽,找到:
<Directory "D:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>

刪除其中的 Options 改成
<Directory "D:/xampp/htdocs">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

將logs做rotation
ErrorLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/error-%Y%m%d.log 86400"
CustomLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/access-%Y%m%d.log 86400" combined

將 / 重導至 HTTPS
<If "%{HTTP_HOST} != 'www.sclai.tk'">
    Redirect "/" "https://www.sclai.tk/"
</If>

<If "%{HTTPS} != 'on'">
    Redirect "/" "https://www.sclai.tk/"
</If>

修正httpd-ssl.conf下列內容:

  1. 將logs定時rotation
  2. #ErrorLog "D:/xampp729/apache/logs/error.log"
    ErrorLog "|D:/xampp729/apache/bin/rotatelogs.exe D:/xampp729/apache/logs/error-%Y%m%d.log 86400"

    #TransferLog "D:/xampp729/apache/logs/access.log"
    TransferLog "|D:/xampp729/apache/bin/rotatelogs.exe D:/xampp729/apache/logs/access-%Y%m%d.log 86400"

    #CustomLog "D:/xampp729/apache/logs/ssl_request.log" \
              "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    CustomLog "|D:/xampp729/apache/bin/rotatelogs.exe D:/xampp729/apache/logs/ssl_request-%Y%m%d.log 86400" \
              "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

  3. 調整ServerName及ServerAdmin
  4. #ServerName www.example.com:443
    #ServerAdmin admin@example.com
    ServerName www.myname.com:443
    ServerAdmin nobody@gmail.com

  5. 配合sslforfree調整憑證檔案(全部憑證置放於conf/sslforfree/目錄下)
  6. #SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateFile "conf/sslforfree/certificate.crt"

    #SSLCertificateKeyFile "conf/ssl.key/server.key" SSLCertificateKeyFile "conf/sslforfree/private.key" SSLCACertificateFile "conf/sslforfree/ca_bundle.crt"

修正php.ini的下列內容:

  1.  設定 PHP 的時區
  2. 開啟imap extension

設定PHP的時區
找到
[Date] ;date.timezone =

改成
[Date] date.timezone = "Asia/Taipei"

或者在 php 中加入:
date_default_timezone_set("Asia/Taipei");

就可以確保時區的正確性。

開啟imap extension
找到
;extension=imap

改成
extension=imap

2018年2月18日 星期日

Hard Links, Junctions, and Symbolic Links

在NTFS上有Hard link,Junction和Symbolic link三種,簡單來說:

  1. Hard Link就是檔案本身,僅適用在本機磁碟
  2. Junction是hard link的一種,專用於目錄
  3. Symbolic link本身就是一個檔案,指向鎖鏈結的檔案或目錄
詳細內容可參考:

可使用 mklink 來建立三種鏈結。

C:\>mklink /?
建立符號連結。

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      建立目錄符號連結。預設是檔案符號連結。
        /H      建立永久連結而不是符號連結。
        /J      建立目錄連接。
        Link    指定新符號連結名稱。
        Target  指定新連結參照的路徑 (相對或絕對)。

2018年2月17日 星期六

Apache logs rotation

XAMPP中apache的(\xampp\apache\logs]) access log和error log會隨時間增長,
可利用 (\xampp\apache\bin\) rotatelogs.exe 來 rotate log:

修改 (\xampp\apache\conf\) httpd.conf,運用 rotatelogs.exe 每 86400 秒產生一個檔案:
#ErrorLog "logs/error.log"
ErrorLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/error-%Y%m%d.log 86400"

#CustomLog "logs/access.log" combined
CustomLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/access-%Y%m%d.log 86400" combined

如啟用SSL,須同步修改 http-ssl.conf:
#ErrorLog "D:/xampp/apache/logs/error.log"
ErrorLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/error-%Y%m%d.log 86400"

#TransferLog "D:/xampp/apache/logs/access.log"
TransferLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/access-%Y%m%d.log 86400"

#CustomLog "D:/xampp/apache/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
CustomLog "|D:/xampp/apache/bin/rotatelogs.exe D:/xampp/apache/logs/ssl_request-%Y%m%d.log 86400" \

          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

2017年10月23日 星期一

安裝Bitvise SSH Server

在win10上安裝Bitvise SSH Server應該是很順利的,但是有件事情必須特別留意:

win10上的 port 22 預設是被佔用的,必須利用 services.msc 把 SSH Server Broker 和  SSH Server Proxy 停用,否則就只能換 port 來跑。

有點無聊又容易忘記的小麻煩,紀錄一下....

2017年9月17日 星期日

Word 2016 表格文字不見了

2017/10/04 更新
October 3, 2017, update for Word 2016 (KB4011140)
解決了這一個月來的惱人問題....

原來是 Word 2016 更新後產生的bug,真是的...

要移除 KB4011039

Office\Word 2016 - Text missed from tables cell after KB4011039

Microsoft也承認確實是有問題:

After installing KB 3213656 or KB 4011039, merged table cells don’t work correctly in Word or Outlook

2017 年 9 月 5,更新 Word 2016 (KB4011039)

還說「朕知道了,但要等下個月才會更新...」

害我浪費一堆時間找原因,真是有夠....

2017年7月12日 星期三

Intel AMT

Intel AMT 確實是個很方便的平台工具:

  1. 可以遠端控制電源,相當方便。
  2. 可以遠端看到電腦畫面 (限Intel顯示晶片)
  3. 可以設定是否回應ICMP (不經OS)

2017年7月5日 星期三

Ubuntu 安裝 nfdump 支援 nfcapd -f 及 nfpcapd

在 Ubuntu 16.04.02 TLS 下:

apt-get source nfdump
sudo apt-get build-dep nfdump
sudo apt-get install libpcap-dev fakeroot build-essential
cd nfdump-1.6.12
cd debian
vi rules

  • 將  --enable-readpcap --enable-nfpcapd 加到 DEB_CONFIGURE_EXTRA_FLAGS 最後方

vi control

  • 將 ,libpcap-dev 加到 Build-Depends: 最後方

cd ..
dpkg-buildpackage -rfakeroot
sudo dpkg -i ../nfdump_1.6.12-0.2_amd64.deb

完工!

nfpcapd 在 nfdump-1.6.12/bin 下,需人工安裝:
sudo cp bin/nfpcapd /usr/bin
sudo chown root.root /usr/bin/nfpcapd
sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/nfpcpad

就可以使用 nfpcapd 了!