• After extensive research on Hexo, another way to deploy Hexo was to use an Nginx reverse proxy port to allow Hexo to be accessed by domain name or IP.
  • As I wrote in my last post, deploying Hexo on Alibaba Cloud was very troublesome and tedious (I thought everyone else was deploying it like this). It is also local construction, and when it is built, it needs to be pushed to the remote server. The process is too tedious.
  • When I first got into Hexo, I thought I was doing it through Nginx, but I mistakenly thought everyone else was doing it through Git. It can be said that god pays off.
  • Through this deployment of Hexo, we learned how to efficiently use search engines to search for data. Don’t add too many useless words to your search, just select a few important keywords. If you search for too many words, the search engine will only find a lot of similar things, and the key points will be hidden, so use them correctly.
  • This is a bit of nonsense, so here’s the deployment tutorial.
  • Hexo is purely a static blogging framework, so PHP is not required.
  • First of all, I am deploying Centos7.3 on Ali Cloud, nginx environment configuration has been set up, set up nginx and configuration can visit my blog: blog.csdn.net/qq_41684621…
  • To configure the Node environment, hexo requires Node. js support, so install Node. js first. For installing Node. js on centos7.3, visit my previous blog post: blog.csdn.net/qq_41684621…
  • Log in to the cloud server as root and create a folder that belongs to hexo. Mine is in /usr/local/.
  • After installing node and configuring it, install Hexo
npm install hexo-cli -g
Copy the code
  • Add hexo to global: hexo can be found in nodejs lib/node_modules/hexo-cli/bin



    The method is to adopt soft connection:
ln -s /usr/local/ node - v12.13.1 / lib/node_modules/hexo - cli/bin/hexo/usr /local/bin/hexo
Copy the code
  • Deploy the hexo blog folder, which can be placed outside nodejs for easy opening, such as creating the hexo folder under /usr/local/
mkdir hexo
Copy the code
  • Initialize the blog in hexo folder hexo, which will then automatically generate the resource file.
hexo init 
Copy the code

If the following information is displayed, the initialization is successful.



Then look at the generated directory:

  • Here are a few common commands for Hexo:

  • Start the hexo
hexo s
Copy the code



The Hexo blog runs on port 4000, which can be accessed using the server’s IP:4000.

  • Note: You must first open port 4000 on the server to access.

Use the generated public folder as the root of your web site

  • After resolving the secondary domain name or directly using the primary domain name, in the nginx directory conf file nginx.conf file, I here is the secondary domain name, configuration as follows:
 server {
    listen 80;
    server_name hexo.xdr630.top;
  	index index.html index.htm;
   	root /usr/local/hexo/public
   	}
Copy the code

After the addition, use the reload command to execute in the sbin directory of nginx:

./nginx -s reload
Copy the code
hexo g
Copy the code

/usr/local/source/_posts /usr/local/source/_posts /usr/local/source/_posts /usr/local/source/_posts

  • In the hexo directory, open the _config.yml configuration file and change the URL to the resolved domain name or IP address



    Save and exit.

Publish an article

  • /usr/local/hexo/source/_posts/hexo gGenerate. There is no need to create articles on the server for publication.
  • Just pick up one of my original MD articles and implement it:

  • After upload, generate:
hexo g
Copy the code
  • Access:hexo.xdr630.top

Hexo also has a number of themes, comment plugins, and custom designed blogs.