From 606976b40bd07973cc87a3c9d169a04d978aff73 Mon Sep 17 00:00:00 2001 From: ymhierarch Date: Sat, 11 Sep 2021 18:25:15 +0800 Subject: [PATCH] add files --- ...5\262Easyimage\345\233\276\345\272\212.md" | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 "docker/nginx\351\203\250\347\275\262Easyimage\345\233\276\345\272\212.md" diff --git "a/docker/nginx\351\203\250\347\275\262Easyimage\345\233\276\345\272\212.md" "b/docker/nginx\351\203\250\347\275\262Easyimage\345\233\276\345\272\212.md" new file mode 100644 index 0000000..7727524 --- /dev/null +++ "b/docker/nginx\351\203\250\347\275\262Easyimage\345\233\276\345\272\212.md" @@ -0,0 +1,125 @@ +# nginx部署Easyimage图床 + +1. ## 创建数据文件夹 + +```shell +$ mkdir -p /app/imgbed/nginx/conf +$ mkdir -p /app/imgbed/nginx/conf.d +$ mkdir -p /app/imgbed/nginx/www +$ mkdir -p /app/imgbed/nginx/log +``` + +2. ## 创建nginx配置文件 + +```shell +$ vi /app/imgbed/nginx/conf/nginx.conf + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +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; +} + +$ vi /app/imgbed/nginx/conf.d/default.conf +server { + listen 80; + listen [::]:80; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} +``` + +3. ## 复制图床文件到网站根目录 + +```shell +$ cp EasyImages2.0-2.2.2/* /app/imgbed/nginx/www +``` + +4. ## 确认/app/imgbed的权限(root用户忽略) + +```shell +$ chown -R 165536:165536 /app/imgbed +``` + +5. ## 创建nginx docker容器 + +```shell +$ sudo docker run --name docker_nginx -d -p 8080:80 \ +--name imgbed \ +-v /app/imgbed/nginx/log:/var/log/nginx \ +-v /app/imgbed/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \ +-v /app/imgbed/nginx/conf.d:/etc/nginx/conf.d \ +-v /app/imgbed/nginx/www:/usr/share/nginx/html \ +nginx +``` + +6. ## 进入docker容器 + +```shell +$ docker exec -it {容器名} bash +``` + -- Gitee