找到my.cnf (/etc/my.cnf), 加上以下設定

[mysqld]
skip-grant-tables
skip-networking

駱韋仲 發表在 痞客邦 留言(0) 人氣()

docker網段預設是 172.17.0.0/16, 更改網段流程如下

1. 修改/etc/docker/daemon.json的bip, 範例內容如下(將網段改成127.7.0.1/16)

{
        "bip": "172.7.0.1/16"
}

駱韋仲 發表在 痞客邦 留言(0) 人氣()

nginx proxy cache實作

nginx proxy cache可將網站的整頁page做cache, 不過目前不支援https

建議針對需求只cache可以被整頁cache的page

建議與load balancer一起搭配使用, 將憑證掛在load balancer, 並且load balancer到proxy server的這段通訊透過80 port連線

以下是新增proxy server的做法

架構如下

駱韋仲 發表在 痞客邦 留言(0) 人氣()

取得ec2 instance中繼資料
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/

駱韋仲 發表在 痞客邦 留言(0) 人氣()

利用composer-patches修改vendor底下的程

透過composer安裝第三方php package已是常態, 但當php package有bug可是還未釋出修正時

比較笨的做法就是直接修改vendor底下的程式, 但這樣的做法在每次重新安裝compose packages時都需要手動修改相關的bug程式

這樣的調整沒辦法受到版控軟體控制, 容易造成人為的疏失

以下是透過 cweagans/compose-patches 利用打補丁的方式去修改vendor底下的程式, 這樣在每次重新安裝compose packages都會自動修正bug程式
以下範例已修改guzzlehttp程式為例

駱韋仲 發表在 痞客邦 留言(0) 人氣()

一般在執行更改mac address指令時會出現以下錯誤

ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address

這時斷開有線網路, WIFI保持連線的狀態下執行指令

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z

駱韋仲 發表在 痞客邦 留言(0) 人氣()

git remote rename origin old-origin
git remote add origin <new-remote>
git fetch old-origin --prune
git push --prune origin +refs/remotes/old-origin/*:refs/heads/* "+refs/tags/*:refs/tags/*"

駱韋仲 發表在 痞客邦 留言(0) 人氣()

在server內加入以下設定

location ^~ /api/v1/your_api {
# 後端的 Web Server, 即真實伺服器:
proxy_pass https://www.abc.com/api/v1/your_api;
# 定義 header 變數, 記錄使用者的 IP

駱韋仲 發表在 痞客邦 留言(0) 人氣()

image

可用指令 show processlist 查詢process清單, 會出現類似以下的列表

可以在Info欄位看到各個process的query, 可用指令 kill {id} 直接刪除process

駱韋仲 發表在 痞客邦 留言(0) 人氣()

SET global log_output = 'FILE';
SET global general_log_file = '/var/lib/mysql/query.log';
SET global general_log = 1;

駱韋仲 發表在 痞客邦 留言(0) 人氣()

在/etc/nginx/nginx.conf定義log format如下範例

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

駱韋仲 發表在 痞客邦 留言(0) 人氣()

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
yum install php81-php-{cli,fpm,mysqlnd,zip,devel,gd,mcrypt,mbstring,curl,xml,pear,bcmath,json,redis}

駱韋仲 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。