🤖 TLDR By ChatGPT 本指南提供了在服务器上设置Git仓库、将本地Hexo页面推送到服务器仓库、在服务器上创建Nginx配置文件以及在服务器上运行Nginx容器的方法。
在服务器上的指定路径下运行git init初始化Git仓库。
参考Easy Hexo指南,使用提供的配置将本地Hexo页面推送到服务器仓库。
提供的配置在服务器上创建Nginx配置文件,包括MIME类型、日志、SSL和HTTP和HTTPS的服务器块。
使用官方Docker镜像在服务器上运行Nginx容器。使用docker pull nginx拉取镜像,然后使用提供的命令运行容器。
请确保用适当的值替换所有<todo: comment>占位符。
There are several <todo: comment>
need to be replaced.
✨Initialise git repository on server 1 2 3 cd <todo: the path for repository>git init
✨Push local hexo pages to server repository Reference: 部署 Hexo | Easy Hexo 👨💻
1 2 3 4 5 6 # Deployment ## ✨Docs: https://hexo.io/docs/one-command-deployment deploy: - type: git repo: <todo: server user name>@<todo: server address>:<todo: server git repo absolute path> branch: <todo: the branch will push>
✨Create nginx config file on server 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 user nginx; worker_processes auto; error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid; events { worker_connections 1024; } http { # Set MIME types include /etc/nginx/mime.types; default_type application/octet-stream; # Set up logging 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; # SSL configuration ssl_certificate /etc/nginx/ssl.pem; ssl_certificate_key /etc/nginx/ssl.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; # HTTP server block to redirect to HTTPS server { listen 80; server_name <todo: server name>; return 301 https://$host$request_uri; } # HTTPS server block for the site server { listen 443 ssl http2; server_name <todo: server name>; root /usr/share/nginx/html; index index.html; # Set up SSL ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; resolver 1.1.1.1 1.0.0.1 8.8.8.8 valid=300s; resolver_timeout 5s; # Set up access logs access_log /var/log/nginx/access.log main; # Set up location for static files location / { try_files $uri $uri/ =404; } } }
✨Run nginx container on server Reference: nginx - Official Image | Docker Hub
1 2 3 4 5 6 7 8 9 docker run \ --name <todo: container name> \ -v <todo: html path>:/usr/share/nginx/html:ro \ -v <todo: nginx.conf path>:/etc/nginx/nginx.conf:ro \ -v <todo: ssl key path>:/etc/nginx/ssl.key:ro \ -v <todo: ssl pem path>:/etc/nginx/ssl.pem:ro \ -p 80:80 \ -p 443:443 \ -d nginx
END.
Author: YangSier (discover304.top )
🍀碎碎念🍀 Hello米娜桑,这里是英国留学中的杨丝儿。我的博客的关键词集中在编程、算法、机器人、人工智能、数学等等,持续高质量输出中。🌸唠嗑QQ群 :兔叽の魔术工房 (942848525)⭐B站账号 :白拾Official (活跃于知识区和动画区)
Cover image credit to AI generator.