Docker Hub 的服务器在国外,比较慢,可以用 DaoCloud.io免费的国内镜像服务,官方参考https://docs.docker.com/engine/installation/
环境:Docker Engine + runc + Ubuntu1804lts
检查服务器版本
uname -a
cat /proc/version
lsb_release -a
移除旧版本
apt-get remove docker docker-engine docker-ce docker.io
安装新版本,使apt可以通过HTTPS使用存储库(repository)
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
Install packages to allow apt to use a repository over HTTPS
apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> software-properties-common
添加Docker官方的GPG密钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
如果Ubuntu 18.04 LTS (Bionic Beaver) docker package is not available,则通过如下语句安装stable存储库
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable"
安装docker-ce
apt-get install -y docker-ce
也可查看可用版本并安装
apt-cache madison docker-ce
apt-get install docker-ce=<VERSION>
查看服务和启动
systemctl status docker
systemctl start docker
systemctl restart docker.service
测试Hello World
docker run hello-world
查看本地Docker镜像库
docker images
安装Apache并测试http://IP
docker run -d -p 80:80 httpd
<div>apt-get updateapt-get install squidvi /etc/squid3/squid.conf将http_access deny deny 改为 http_access allow all将http_port 3128修改为自己的端口http_port 6666</div>
service squid3 restart
这时是透明代理,会有via字段和X-Forwarded-For字段显示IP,需要匿名的话就需要修改配置
查看版本
squid3 -v
vi /etc/squid3/squid.conf
不同版本号以及对应代码
Squid 2.x
header_access Via deny all
header_access X-Forwarded-For deny all
Squid 3.0
reply_header_access Via deny all
reply_header_access X-Forwarded-For deny all
Squid 3.1以及以上版本
via off
forwarded_for delete
service squid3 restart
vi /etc/ssh/sshd_config
PermitRootLogin without-password
PermitRootLogin yes
service ssh restart
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
安装PHP7.2和通用扩展:
sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
启动PHP7.2-FPM:
sudo systemctl start php7.2-fpm
系统自启动:
sudo systemctl enable php7.2-fpm
检查其状态:
systemctl status php7.2-fpm
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
listen [::]:80;
server_name att.cool;
root /usr/share/nginx/html/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
location ~ /.ht {
deny all;
}
}