If we deploy the one click installation package or panel for the WEB environment in the server, we can directly use the one click package command or visual command to add and modify the domain name binding. If we deploy Nginx manually, we need to deploy domain name binding manually. Before binding the domain name, we need to resolve the domain name A record to the current server IP in advance, and then modify the Nginx configuration file.
vi /etc/nginx/nginx.conf
Find the corresponding CONF file or the configuration file of a site.
server { listen 80 default_server; server_name www.laozuo.org laozuo.org; root /home/web1; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50.xhtml; location = /50x.html { } } server { server_name www.lezaiyun.com lezaiyun.com; root /home/web2; location / { } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
In the above code, we add and modify the domain name resolution.
Finally, after saving and exiting, restart Nginx to take effect.