Nginx Proxy Hexo and Domain Name Configuration Terminal (3)

We have previously successfully injected Hexo into our server via Docker-Compose. Students with a domain name should not want othershttp://<host>:4000Who 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):


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.

  1. Open Alibaba Cloud and enter the domain name management

  2. Click on the domain name that we are purchasing

  3. Enter domain name resolution

  4. Add a note

  5. Fill in the domain name prefix information

  6. 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'
    restart: always
    image: nginx:1.16.1
    container_name: nginx
    hostname: nginx
      - 80:80
      - 443:443
      - hexo:hexo 
      - <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
      - 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;


Leave a Comment