We have previously successfully injected Hexo into our server via Docker-Compose. Students with a domain name should not want othershttp://<host>:4000
Who is this. This section mainly displays the domain name purchased with the Alibaba cloud console and equipped with Nginx proxy to realize the real battle against the domain name to visit Hexo blog
Production environment (linux server):
last:
The above conditions are required. Please install by yourself before following steps
Alibaba cloud domain settings
Уведомление:
It’s not about binding the domain name to the server, just imagine how to set analytics rules on Alibaba’s cloud console
Because the public network DNS server is not updated in real time. There is an update cycle, so we prepared this step first. This can avoid domain names that are not updated by the DNS server in time, so it may be our access failure problem.
-
Open Alibaba Cloud and enter the domain name management
-
Click on the domain name that we are purchasing
-
Enter domain name resolution
-
Add a note
-
Fill in the domain name prefix information
-
Waiting for TTL time. Alibaba Cloud will help us set up automatic updates on the public DNS server
Here we still use Docker-Compose to install Nginx, the mirror version of nginx is free to choose, it is best to use the official Docker image.
Because the Hexo version of the current Demo is also managed by Docker-Compose. If it does not match the author’s configuration, please move: {%post_link Hexo-Docker%}
заявление:
$your_nginx_host nginx is the long running working path in your host. Exp: /usr/local/docker/nginx
Docker-compose.yml setup
version: '2'
services:
nginx:
restart: always
image: nginx:1.16.1
container_name: nginx
hostname: nginx
ports:
- 80:80
- 443:443
links:
- hexo:hexo
volumes:
- <your_nginx_host>/conf.d:/etc/nginx/conf.d
- <your_nginx_host>/html:/var/www/html
- <your_nginx_host>/static:/var/www
- <your_nginx_host>/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- hexo
nginx setup /conf.d
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server {
listen 80;
server_name <your_server_name>;
add_header 'Access-Control-Allow-Origin' '*';
location / {
proxy_pass http://hexo:4000/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}