web123456

Nginx configuration for static web access (graphical interface)

catalogs

  • preamble
  • main body (of a book)

preamble

After testing the website or project locally, deploy it to the server to go live
If a static page can be deployed bynginxexecutable configuration
This article explains the nginx static deployment project

After testing it locally, upload its files to the server
(The blogger used docusaurus to build the site)
The locally generated build file is uploaded to the server using the scp command.
(Cope scp command:scp -P Port number Local file to be uploaded Username@IP address:/ Server storage location

More details about nginx to add to your knowledge
See my previous post
Nginx from Beginner to Master (Full)

main body (of a book)

Go to the configuration file, the blogger's configuration file is in /etc/nginx
If there is already a conf file, make a copy of the file via cp, or just write the following configuration file (just change the corresponding location)

The specific configuration files are listed below:

server {
    listen 15599; // access port number, try to port number after some, do not have a port conflict
    charset utf-8; //Character set utf-8; //Character set utf-8.

    server_name server ip address ;//server_name; //server_name server ip address; //server_name server ip address
    error_page 404 ;

    location / {
        root project_address ; index ;
        index ;
       }

}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

After configuring the file

  • ps -ef |grep nginx , check if nginx is up (./nginx(That is, the nginx relative path to the current path)
    在这里插入图片描述
    As you can see from the configuration file above its in./nginxRun, the installation location is different for different computers (change to your path and run the following command)

  • /usr/local/nginx/sbin/nginx -tIf the format of the file is correct, check if the file format is correct (return success that the format is correct)
    The above is an absolute path, if you want to use a relative path, use it in the sbin directory./nginx -tcommand

  • /usr/local/nginx/sbin/nginx -s reloadIf you want to restart nginx, you have to restart nginx if you change the configuration.
    The above is an absolute path, if you want to use a relative path, use it in the sbin directory./nginx -s reloadcommand

Afterwards, it is verified through the extranet
The main validation is done in the form of:Server ip address:Port number