上文:基于 Hexo 的 Github 博客搭建
注意:通過驗(yàn)證部署,確定無誤。AI生成的部分有??圖標(biāo)。
?? TLDR By ChatGPT
本指南提供了在服務(wù)器上設(shè)置Git倉庫、將本地Hexo頁面推送到服務(wù)器倉庫、在服務(wù)器上創(chuàng)建Nginx配置文件以及在服務(wù)器上運(yùn)行Nginx容器的方法。
- 在服務(wù)器上的指定路徑下運(yùn)行g(shù)it init初始化Git倉庫。
- 參考Easy Hexo指南,使用提供的配置將本地Hexo頁面推送到服務(wù)器倉庫。
- 提供的配置在服務(wù)器上創(chuàng)建Nginx配置文件,包括MIME類型、日志、SSL和HTTP和HTTPS的服務(wù)器塊。
- 使用官方Docker鏡像在服務(wù)器上運(yùn)行Nginx容器。使用docker pull nginx拉取鏡像,然后使用提供的命令運(yùn)行容器。
請(qǐng)確保用適當(dāng)?shù)闹堤鎿Q所有<todo: comment>占位符。
There are several <todo: comment>
need to be replaced.
?Initialise git repository on server
cd <todo: the path for repository>
git init
?Push local hexo pages to server repository
Reference: 部署 Hexo | Easy Hexo ?????
# 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
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
# pull nginx docker image
docker pull nginx
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米娜桑,這里是英國留學(xué)中的楊絲兒。我的博客的關(guān)鍵詞集中在編程、算法、機(jī)器人、人工智能、數(shù)學(xué)等等,持續(xù)高質(zhì)量輸出中。
??嘮嗑QQ群:兔嘰の魔術(shù)工房 (942848525)
?B站賬號(hào):楊絲兒Online(活躍于知識(shí)區(qū)和動(dòng)畫區(qū))
Cover image credit to ??AI generator.文章來源:http://www.zghlxwxcb.cn/news/detail-428553.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-428553.html
到了這里,關(guān)于【模板】Hexo Docker Nginx 個(gè)人博客服務(wù)器部署的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!