风格延续之前的 WordPress
、Typecho
,这里只记录 docker-compose.yml
文件和 nginx 的配置文件,启用 SSL
项目地址:EasyImage 简单图床 2.0
相关见:
创建使用目录
1
| mkdir easyimages && cd easyimages && touch docker-compose.yml && mkdir volumes
|
修改 yml 文件
编辑 docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13
| version: '3.3' services: easyimage: image: ddsderek/easyimage:latest container_name: easyimage ports: - 80:80 - 443:443 volumes: - ./volumes/easyimages/config:/app/web/config - ./volumes/easyimages/i:/app/web/i - ./volumes/nginx/conf.d:/etc/nginx/conf.d restart: unless-stopped
|
配置 Nginx
前台运行容器
当屏幕不再有输出的时候 Ctrl + C
停止运行,开始配置 Nginx
1
| cd volumes/nginx/conf.d/ && mkdir certs && touch easyimages.conf
|
编辑 easyimages.conf
文件,需要修改域名为自己的域名,修改证书文件的名字,证书必须放到 /volumes/nginx/conf.d/certs/
目录下,毕竟上面只映射了这一个 nginx 目录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| server { listen 80; listen [::]:80; # 修改域名 server_name example.com;
client_max_body_size 512M; sendfile on; location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; # 修改域名 server_name example.com; # 修改证书文件名字 ssl_certificate /etc/nginx/conf.d/certs/example.com.crt; ssl_certificate_key /etc/nginx/conf.d/certs/example.com.key;
add_header X-Request-ID $request_id; root /app/web; index index.php index.html;
ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; client_max_body_size 512M; sendfile on;
location ~* ^/(i|public)/.*\.(php|php5)$ { deny all; }
location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name; fastcgi_param X_REQUEST_ID $request_id; include fastcgi_params; fastcgi_read_timeout 180s; } }
|
再次运行
使用域名访问即可
Docker-Compose 快速搭建 EasyImages2.0 图床