Nginx builds a web server

  Now that there are so many web servers, I think a very important advantage of nginx server is that it can maintain efficient services while supporting high concurrent requests. Next, I will build a simple web server.

  1. Write your own web page

    Create a new folder in the nginx directory (you can create a new folder anywhere, the difference is the server location / different)

    Create your own html web page and authorize (chmod -R 644 filename), otherwise, other people will have a 403 forbidden error when accessing

  2. Configure the virtual server

    server {
        listen        80 ; #Listen on port 80 by default, you can modify it as needed
        server_name localhost; #domain name 
}

  3. Configuration location

        location / { #The default root directory is the nginx directory
            root stone; #Web page storage folder
            #index  index.html index.htm;
        index index.html index.htm; #The name of the web page, that is, the home page
        }

  4. Result display

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325343256&siteId=291194637