LEMP server on CentOS 7.x with FastCGI

參考網頁:LEMP server on CentOS 7 with FastCGI

安裝 epel-release 套件
# yum install epel-release

安裝 Mariadb SQL Server
# yum install mariadb-server mariadb

啟動 Mariadb SQL Server
# systemctl enable mariadb
# systemctl start mariadb

第一次使用時的設定
# /usr/bin/mysql_secure_installation[@more@]安裝 Nginx Web Server
# yum install nginx

修改設定檔 /etc/nginx/nginx.conf
# vim /etc/nginx/nginx.conf
server 區段中加入
   server {
        listen       80 default_server;
        (略)

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        location ~ .php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

啟動 Nginx Web Server
# systemctl enable nginx
# systemctl start nginx

開啟防火牆設定
# firewall-cmd –permanent –zone=public –add-service=http
# firewall-cmd –permanent –zone=public –add-service=https

安裝 PHP with FastCGI 套件
# yum install php-cli php spawn-fcgi

新增 /usr/bin/php-fastcgi 設定檔
# vim /usr/bin/php-fastcgi
#!/bin/sh
if [ `grep -c “nginx” /etc/passwd` = “1” ]; then
    FASTCGI_USER=nginx
elif [ `grep -c “www-data” /etc/passwd` = “1” ]; then
    FASTCGI_USER=www-data
elif [ `grep -c “http” /etc/passwd` = “1” ]; then
    FASTCGI_USER=http
else
# Set the FASTCGI_USER variable below to the user that
# you want to run the php-fastcgi processes as

FASTCGI_USER=
fi

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u $FASTCGI_USER -f /usr/bin/php-cgi

更新檔案權限
# chmod +x /usr/bin/php-fastcgi

新增 /etc/systemd/system/php-fastcgi.service 設定檔
# vim /etc/systemd/system/php-fastcgi.service
[Unit]
Description= php-fastcgi systemd service script

[Service]
Type=forking
ExecStart=/usr/bin/php-fastcgi start

[Install]
WantedBy=multi-user.target

啟動相關服務
# systemctl daemon-reload
# systemctl enable php-fastcgi.service
# systemctl start php-fastcgi.service

隱藏 Nginx Web Server 版本

Nginx Web Server 在找不到預設首頁時,會出現如下的圖

畫面上會出現使用的 Web Server 種類及版本[@more@]隱藏方式:CentOS 7.x
1. 先備份原設定檔
# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.$(date +%F)

2. 在 nginx.conf  設定檔中加入 server_tokens off; 設定
# /bin/sed -i ‘/root         /usr/share/nginx/html;/a        server_tokens off;’ /etc/nginx/nginx.conf

3. 重新啟動 Nginx Web Server
# systemctl restart nginx

4. 就不會再出現版本號碼了,但還是會出現 Web Server 種類,想到的解決方式可能是把 404 網頁換掉

sed 一次性插入多行

有時候須要利用 sed 來修改設定檔
原本的檔案,要在 1 和 4 之間插入 2 & 3
# cat /root/testfile
1
4
5
6
7[@more@]# sed -i ‘/1/a2n3’ /root/testfile

# sed -i ‘/4/i2n3’ /root/testfile

處理完後
# cat /root/testfile
1
2
3
4
5
6
7

另外的一行方式
參考網頁:sed在匹配行之下追加多行文本 – 陆小K网络工作室 – 51CTO技术博客
找到 7 後,在下方插入 /root/nginx.conf 內容
# sed -i ‘/7/r /root/nginx.conf’ /root/testfile

解決 Windows 10 1511 10586 無法使用網路芳鄰的問題

原本有一台 NAS 在家裡使用一直都沒有什麼太大的問題,但自從把 Windows 10 升級到最新的 1511 10586 的版本後,卻出現無法使用的問題。
[@more@]解決方式:參考以下網站:
[加油。電腦疑難雜症] Windows 10 更新後,網路芳鄰無法找到其他裝置 @ 家佑。加油 :: 痞客邦 PIXNET ::

1. 以系統管理員身份執行 命令提示字元
輸入下面二行指令
SC.EXE config lanmanworkstation depend=bowser/mrxsmb10/nsi
SC.EXE config mrxsmb20 start=disabled

2. 重新開機後,就可以正常使用了!

Firefox 45.0.1 版

直接下載新的版本安裝
Windows 版本:
x86 版本
http://ftp.mozilla.org/pub/firefox/releases/45.0.1/win32/zh-TW/Firefox%20Setup%2045.0.1.exe
x64 版本
http://ftp.mozilla.org/pub/firefox/releases/45.0.1/win64/zh-TW/Firefox%20Setup%2045.0.1.exe

Mac 版本:
http://ftp.mozilla.org/pub/firefox/releases/45.0.1/mac/zh-TW/Firefox%2045.0.1.dmg

ESR 版本:
Windows 版本:
x86 版本
http://ftp.mozilla.org/pub/firefox/releases/45.0.1esr/win32/zh-TW/Firefox%20Setup%2045.0.1esr.exe
x64 版本
http://ftp.mozilla.org/pub/firefox/releases/45.0.1esr/win64/zh-TW/Firefox%20Setup%2045.0.1esr.exe

Mac 版本:
http://ftp.mozilla.org/pub/firefox/releases/45.0.1esr/mac/zh-TW/Firefox%2045.0.1esr.dmg

Opera 瀏覽器

一般使用瀏覽器大都是使用 Firefox,公文系統則才改用 IE,偶爾因為特殊的原因才兼用 Google Chrome,現在再加上 Opera 這一個瀏覽器。

Opera 官方網站:http://www.opera.com/zh-tw/computer/windows
下載 Opera 離線安裝版:http://www.opera.com/download/get/?partner=www&opsys=Windows[@more@]
目前安裝的外掛程式:
Adblock Plus
https://addons.opera.com/zh-tw/extensions/details/opera-adblock/

WOT
https://addons.opera.com/zh-tw/extensions/details/wot/

YouTube Downloader
https://addons.opera.com/zh-tw/extensions/details/youtube-downloader-2/

Adobe Flash Player 21.0.0.182



檢查安裝版本:https://www.adobe.com/tw/software/flash/about/
                             https://get.adobe.com/tw/flashplayer/[@more@]Windows 7 平台
Internet Explorer:  Adobe Flash Player 21.0.0.182
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_21_active_x.exe
Windows 8 / 8.1 / 10 / Server 2012 / Server 2012 R2 要從 Windows Update 更新

All Other Browsers(Firefox,Safari & Opera): Adobe Flash Player 21.0.0.182
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_21_plugin.exe

Chrome:Adobe Flash Player 21.0.0.182
http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ppapi.exe

Mac 平台:
http://fpdownload.adobe.com/get/flashplayer/pdc/21.0.0.182/install_flash_player_osx.dmg