Jan 4

traceroute

#use ipv4
traceroute -4 10.128.150.36
#send package every 2 seconds
traceroute -w 2 10.128.150.36


阅读全文...

Nov 10

HTTP Basic Auth Setting

$auth = base64_encode($uname . ":" . $pass);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Authorization: Basic $auth",
                                              "Accept: application/json",
                                              "Content-Type: application/json"));


阅读全文...

Dec 8

NGINX + PHP7.4 Docker Image

Docker Images

https://hub.docker.com/layers/whatwedo/nginx-php

docker pull whatwedo/nginx-php:v2.2
docker run -d -v /home/self/work/space:/var/www -p 80:80 --name php74 whatwedo/nginx-php:v2.2
docker exec -it php74 /bin/sh



阅读全文...

Dec 7

非root用户运行docker

创建docker组

sudo groupadd docker


将当前用户加入docker组

sudo gpaswd -a ${USER} docker


重新启动docker服务

sudo systemctl restart docker.io


当前用户退出系统重新login

测试docker命令

docker ps


阅读全文...

Nov 17

HTTP自动转向HTTPS

Apache 版本

如果需要整站跳转,则在网站的配置文件的<Directory>标签内,键入以下内容:

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R=301]


如果对某个目录做https强制跳转,则复制以下代码:

RewriteEngine on
RewriteBase /yourfolder
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]


Nginx版本

在配置80端口的文件里面,写入以下内容即可。

server {
        listen       80;
        server_name  localhost;
        rewrite ^(.*)$ https://$host$1 permanent;    
}



阅读全文...