關於網路那些事...

Marketing, SEO, Web trends, Programming tutorial, Web design, and Life event...

SSH 限定連線後閒置多久自動中斷,以及如何閒置不中斷

當使用者 SSH 連結至主機後,為了避免閒置過久

可以設定閒置多久可自動中斷

先開啟 SSH 設定檔

vim /etc/ssh/sshd_config

Continue Reading

SSH 設定限定輸入密碼時間

在SSH連線時,會詢問連線密碼

預設等待時間是 2 分鐘,並且可以修改

首先,開啟sshd_config 設定檔案

vim /etc/ssh/sshd_config

將時間設定為 60 秒

LoginGraceTime 30s

接著重新啟動 ssh server

service sshd restart

Continue Reading

Apache 安裝及設定 PHP 環境、SSL 及查看DNS

Apache 安裝及設定 PHP 環境、SSL 及查看DNS

安裝

yum install httpd -y

防火牆設定

vim /etc/sysconfig/iptables

Continue Reading

Linux - grep 命令參數說明

Linux - grep 命令參數說明

在Linux 環境中,常用 grep 來搜尋文本內容,找出匹配的項目

grep 全寫是 (global search regular expression(RE) and print out the line)

底下介紹 grep 參數用法

Continue Reading

記憶體評估可承載人數

記憶體評估可承載人數

假設不考慮 CPU 的情況下,由記憶體評估可承載在線人數估算方法為例:

記憶體 3.6 Gb = 3865470566.4 bps

若以 每人佔用 200 Kb 記憶體來說

1.6G (2G) 記憶體可承載約 8.5 K 進程

1.6*1024*1024*1024/200000 = 8589.934592

3.6G (4G) 記憶體可承載約 19.3 K 進程

3.6*1024*1024*1024/200000 = 19327.35283

Continue Reading

Apache 查看目前連線人數

查看目前Apache 目前在線人數

可以透過httpd 進程數量來推算

ps -ef|grep httpd|wc -l

43

若要查看每一筆進程則輸入

ps -ef|grep httpd


apache    3817  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3864  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3924  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3944  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3946  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3949  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    3950  2860  0 03:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4017  2860  0 03:42 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4025  2860  0 03:42 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4038  2860  0 03:42 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4051  2860  0 03:42 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4199  2860  0 03:43 ?        00:00:03 /usr/sbin/httpd -DFOREGROUND
apache    4214  2860  0 03:44 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7368  2860  0 04:10 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache    7406  2860  1 04:10 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache    7493  2860  1 04:11 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache    7591  2860  1 04:12 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7618  2860  1 04:12 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache    7702  2860  0 04:12 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7714  2860  0 04:12 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7717  2860  1 04:12 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7860  2860  0 04:13 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7868  2860  1 04:13 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7879  2860  1 04:13 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7882  2860  0 04:13 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7925  2860  1 04:13 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache    7930  2860  0 04:13 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7931  2860  1 04:13 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7945  2860  1 04:13 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7976  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7992  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7994  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7995  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    7996  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    8015  2860  2 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    8021  2860  0 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    8062  2860  1 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    8063  2860  3 04:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root      8093  5429  0 04:14 pts/0    00:00:00 grep --color=auto httpd

Continue Reading

Laravel View composer 介紹

Laravel - View Composer

在開始介紹 View composer 之前

首先關於 View 的一些用法為,指定 Template 以及要帶入的參數

Continue Reading

HTTP Response 回應狀態說明 404, 403, 401, 500..

這裡記錄一些常見的HTTP Response 回應狀態:

Continue Reading

Json Hijacking 簡介

Json Hijacking 簡介

Json Hijacking 是一項已經存在多年的安全漏洞,目前各大主流瀏覽器都已經修補

這裡進行說明,什麼是 Json Hijacking 以及防範方式:

Continue Reading

FFMPEG 安裝與使用方式簡介

FFMPEG 安裝與使用方式簡介

現有一個專案使用到 FFMPEG 來處理 Media 轉換

這裏紀錄 Mac, Ubuntu, CentOS 安裝 FFMPEG 以及簡介使用方式

Continue Reading

Linux - IPTraf 快速查看伺服器連線 log

IPTraf 快速查看伺服器連線 log

Continue Reading

Linux - Wget 用法介紹

Linux - Wget 用法介紹

wget 是多數 linux 預設都會安裝的檔案下載工具

可以支援各種檔案下載及執行

底下做一些基本介紹:

Continue Reading

Linux 排程 crontab 介紹

Linux 排程 crontab 介紹

在 Linux 排程可以分成兩種大類別

  1. 單一排程,做完一次即結束
  2. 固定排程,指定時間執行

Continue Reading

查看Linux 主機 CPU 及記憶體用量,刪除指定進程

查看主機運行狀態

top 是一個互動式的即時顯示工具,可以即時查看負載狀況

top

Continue Reading

主機 Web server log, Laravel log 查詢流程紀錄

主機 log 查詢流程紀錄

簡記常用的 web service log 查詢紀錄流程

Continue Reading

上傳頻寬也會影響下載速度:TCP / IP 連線與 ACK 封包介紹

網路封包

TCP / IP (Transmission Control Protocol over Internet Protocol)使用的是三項交握流程

當你的電腦向某台主機請求資源時,你會發送 SYN 訊息給這台電腦

當這台電腦收到訊息後,會開始將資源 SYN/ACK 傳送給你

Continue Reading

電子計算機計量單位

電子計算機計量單位

電腦基本單位

電腦傳輸最基本的單位是 Bit (位元),又稱為 2 進位,由 1 跟 0 所構成。

Continue Reading

Linux tail 使用方式說明

Linux tail 使用方式

tail 可以取得讀取檔案內容,並且會從底部開始輸出

(另一個 head 指令,則是從前面開始輸出內容)

底下舉例:

Continue Reading

MySQL - 如何計算所有 database 大小

紀錄如何查詢 MySQL 資料庫中,所有 database size

語法如下:

SELECT table_schema "DB Name",
        ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
FROM information_schema.tables 
GROUP BY table_schema; 

Continue Reading

敏捷開發 - Scrum 執行 Sprint backlog

Scrum 執行 Sprint backlog

  • 將 Story 轉化成可被執行的 Sprint 清單

    首先,先確認清楚團隊可投入的有效工作時數

Continue Reading