2019年11月4日 星期一

GoAccess 分析工具 NGINX access.log

修改 goaccess.conf
vi /usr/local/etc/goaccess.conf
修改 goaccess.conf的 log-format
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" %^ %^ %T
修改 nginx.conf 的 log_format
vi /etc/nginx/nginx.conf
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time';
修改後, 重啟 nginx
nginx -s reload
log檔路徑
vi /var/log/nginx/access.log

2019年7月21日 星期日

Install macOS High Sierra.app is not a valid installer

1、執行APP的下載器,完成下载步骤,到重新啟動安裝的步驟時,command+Q退出 2、打開Finder,在根目錄下找到macOS Install Data文件夹 3、在应用程序中,找到Install macOS High Sierra,右击显示包内容,在/Contents/下建立“SharedSupport”文件夹 4、将第二步文件夹/macOS Install Data/ 中的所有内容拷貝到第三步新建的文件夹/Contents/SharedSupport中 5、再执行以下script,創建安裝USB碟(注意替换"MyVolume"为你的USB碟名稱) sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install\ macOS\ High\ Sierra.app Password: Ready to start. To continue we need to erase the volume at /Volumes/USB. If you wish to continue type (Y) then press return: y Erasing Disk: 0%... 10%... 20%... 30%...100%... Copying installer files to disk...

2019年6月12日 星期三

ssh with ssh-keygen

本地連到 server_hostname(如 10.123.123.11)
ssh-keygen -t rsa 或 ssh-keygen -d (dsa) => 產生出 id_rsa, id_rsa.pub
chmod 0600 id_rsa
scp -P 22 id_rsa.pub user@server_hostname:~/.ssh/authorized_keys
ssh -P user@server_hostname ls
 
注意: remote(hostname) 端如  /home/user/.ssh不存在
mkdir -p /home/user/.ssh 後, 記得執行
chmod 700 /home/user/.ssh
chmod 600 /home/user/authorized_keys
chmod 755 /home/user
chown user:user -R /home/user

authorized_keys 文件必须是600权限(也就是-rw——-)或者644
.ssh目录必须是700权限(也就是drwx——)
/home/work目录 必须是 755权限 即drwxr-xr-x

2019年6月9日 星期日

nginx revere proxy mssql 1433

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

stream {
    server {
        listen 1433;
        proxy_pass mssql:1433;
    }
}

Centos 7 SELinux 只允許 HTTP


查看模組(例如apache)
# semanage module -l
該模組的設定會放在 /etc/selinux/targeted/active/modules

查看埠號類型
# semanage port -l

和http有關的埠號
# semanage port -l | grep 'http'

把5353埠加入http_port_t的type中
# semanage port -a -t http_port_t -p tcp 5353

Docker nginx


docker exec -it proxy /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"

#cd /etc/nginx/conf.d
#cat default.conf


#cd /usr/share/nginx/html/
#ls -l

#cd /var/log/nginx
#ls access.log
#ls error.log

Linux net tools

apt update
apt upgrade
apt install -y net-tools
ifconfig
apt install -y iputils-ping
apt install -y telnet