Combined use of hugo and nginx
Introduction
Hugo is a static website generator written in go language. It is suitable for building personal blog, company homepage, help and other websites. It is a small CMS system. The advantages of static sites are fast, safe, easy to deploy, and easy to manage.
Hugo advantage
Quick! ! ! UI. . . . . . . .
The fastest static website generator in the world! Create 6000 pages in 5 seconds!
The document is in Markdown format with super simple syntax;
Hugo can be used as a static file generation tool, or a high-performance web service;
Rich site migration tools, you can convert wordpress, Ghost, Jekyll, DokuWiki , Blogger easily migrate to Hugo;
Super detailed documentation;
Active community;
More free content organization;
Rich themes;
Multi-environment support : Macos, linux, windows. .
Reference document
Hugo installation configuration document address:
https://blog.51cto.com/michaelkang/2364007
Commonly used Command details
https://blog.51cto.com/michaelkang/2364096
Character arrangement
hugo: responsible for converting markdown into static files;
nginx: As a web server.
Operation method:
Execute the hugo command, a new folder public/ will be created under the site directory, and all generated static website pages will be stored in this directory. Use nginx as the web service configuration root dir points to public/;
install nginx
yum install nginx
#View version
nginx -V
Modify nginx configuration , Add listening domain name
vi /etc/nginx/conf.d/www.datals.com.conf
server {
listen 80;
# Set the domain name of the site
server_name www.datals.com;
#Point to the hugo public folder
root /www.datals.com/public;
location / {< br /> }
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x .html;
location = /50x.html {
}
}
Start nginx
nginx
Then dns Resolve to point to the server IP address, or write the host file of the machine to point the domain name to the server. The browser can access the domain name to open the test site and check the site effect.