0%

docker nginx

需要一个 autoindex 的 www。先建立一个 guoshuang_labs.conf

1
2
3
4
5
6
7
8
9
10
server {
listen 80;
server_name labs.guoshuang.com;
charset utf-8;
index index.html index.htm index.php;
root /usr/share/nginx/html/guoshuang_labs/;
location / {
autoindex on;
}
}

然后 copy 到 docker nginx 容器

1
docker cp guoshuang_labs.conf nginx:/etc/nginx/conf.d/guoshuang_labs.conf 

重启

1
docker retart nginx

更多参考


1
2
3
4
5
6
# 查找镜像
docker search nginx
# 拉取镜像
docker pull nginx
# 查看本地镜像
docker images
1
docker cp nginx:/etc/nginx/conf.d/guoshuang_demo.conf guoshuang_demo.conf

进入容器

1
docker exec -it nginx bash

autoindex

1
2
3
4
5
6
location /somedirectory/ {
autoindex on;
autoindex_exact_size off;
autoindex_format html;
autoindex_localtime on;
}

autoindex_exact_size; – This directive specifies whether Nginx should display the exact file sizes of the output in the directory index or simply round to the nearest KB, MB, or GB. This directive has 2 options: on | off.

autoindex_format; – This directive specifies what format the Nginx index listing should be outputted to. This directive has 4 options: html | xml | json | jsonp.

autoindex_localtime; – This directive specifies whether the times for the directory listing should be outputted to local time or UTC. This directive has 2 options: on | off.

with php

docker run –name w3 -d webdevops/php-nginx

sudo apachectl stop

sudo apachectl start

docker stop w3
docker rm w3

docker run –name w3 -p 8088:80 -d
-v ~/ddd/www:/app:ro
-v ~/ddd/guo.conf:/opt/docker/etc/nginx/conf.d:ro
webdevops/php-nginx

my cloud

docker pull webdevops/php-nginx

home/guoshuang/myphp/

docker stop w3
docker rm w3

docker run –name w3 -p 8088:80 -d
-v /home/guoshuang/myphp/html:/app
-v /home/guoshuang/myphp/conf:/opt/docker/etc/nginx/conf.d:ro
webdevops/php-nginx

docker restart w3

crontab

https://blog.csdn.net/yelllowcong/article/details/78483579

shell show date

date +’%Y-%m-%d %T’

https://www.cyberciti.biz/faq/unix-linux-getting-current-date-in-bash-ksh-shell-script/

每分钟

          • date +’%Y-%m-%d %T’ > 1.txt

% 要转义

          • 2.sh

看邮件

cat /var/spool/mail/root

每小时

*/60 * * * * /root/2.sh

注意!!网上大笨蛋

  • */1 * * * #错误的每隔一小时执行一次,事实上每分钟执行一次

cd /home/guoshuang/myphp/html/corona/data

curl http://127.0.0.1:8088/qs/get-data-world.php

cd /home/guoshuang/myphp/html/qs/data

cd /home/guoshuang/myphp/conf

docker exec -it w3 /bin/bash

http {
server {
index index.html;
}
}

docker restart w3
docker ps
curl 127.0.0.1:8088