Detailed explanation of downloading, installing and using nginx server

Detailed explanation of downloading, installing and using nginx server

download

http://nginx.org/en/download.html

Unzip

Unzip the downloaded nginx-1.19.8.zip compressed package to D:/applications directory.

The directory structure after decompression is as follows:

<img src="images\nginx-directory.png" style="zoom:80%;border:1px solid gray;" />

Configuration

Find the nginx.conf file in the conf directory and back it up before modifying it.

The modified content is as follows:

worker_processes 1;
 
events {
    worker_connections 1024;
}
 
 
http {
    include mime.types;
    default_type application/octet-stream;
 
    sendfile on;
 
    keepalive_timeout 65;
 
 
    server {
        listen 80;
        server_name localhost;
 
        location / {
            root D:/mycodes/movable-termination;
            index index.html index.htm;
        }
 
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root D:/mycodes/movable-termination ;
        }
 
    }
 
}

Notice

1. 80 after listen indicates the listening port (80 is the default port for WWW service)

2. localhost after server_name indicates the local host. You can access it through http://localhost or http://localhost:80 in the browser address bar in the future.

3 The root option under localtion / option is used to determine the root directory of the WWW service. That is, when accessing http://localhost:80/index.html , index.html will be found in the directory corresponding to root , that is, the directory corresponding to the / after :80 in http://localhost:80/index.html . root in the location = /50x.html option indicates the directory where the jump page is located after an error occurs on the server.

start up

First enter the nginx directory:

cd nginx-1.19.8

Start nginx in the command prompt:

start nginx

After startup, you can see two nginx processes in the task manager

Reload after modifying the configuration to take effect:

nginx -s reload

Orderly exit

nginx -s quit

Fast closing

nginx -s stop

Multiple nginx processes may be started due to multiple nginx starts. In this case, you need to list the information related to these processes:

tasklist /fi "imagename eq nginx.exe"

If you need to kill all these processes, you can use the following command:

taskkill /f /t /im nginx.exe

Note: tasklist, taskkill, and start are all native Windows commands, not provided by nginx.

This is the end of this article about the download, installation and detailed use of nginx server. For more relevant nginx server download content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Using Nginx to build an image server (under Windows environment)
  • How to set up static files on the nginx cache server
  • How to use nginx to build a video-on-demand and live streaming server
  • A complete guide to basic module configuration and usage of Nginx server
  • Detailed explanation of the configuration and use of the map module in the Nginx server
  • Explanation of mandatory cache configuration and cache priority in Nginx server
  • Detailed explanation of HTTP Headers related module configuration in Nginx server

<<:  Do you know how to use mock in vue project?

>>:  HTTP Status Codes

Recommend

js realizes the function of clicking to switch cards

This article example shares the specific code of ...

Ubuntu installation graphics driver and cuda tutorial

Table of contents 1. Uninstall the original drive...

Specific use of Linux man command

01. Command Overview Linux provides a rich help m...

JavaScript design pattern learning proxy pattern

Table of contents Overview Implementation Protect...

Docker container connection implementation steps analysis

Generally speaking, after the container is starte...

Vue uses dynamic components to achieve TAB switching effect

Table of contents Problem Description What is Vue...

Vue's vue.$set() method source code case detailed explanation

In the process of using Vue to develop projects, ...

How to use React to implement image recognition app

Let me show you the effect picture first. Persona...

Solution to the ineffectiveness of flex layout width in css3

Two-column layout is often used in projects. Ther...

Detailed explanation of client configuration for vue3+electron12+dll development

Table of contents Modify the repository source st...

Analysis of two usages of the a tag in HTML post request

Two examples of the use of the a tag in HTML post...

How to create an Nginx server with Docker

Operating environment: MAC Docker version: Docker...

ie filter collection

IE gave us a headache in the early stages of deve...

Explanation of Dockerfile instructions and basic structure

Using Dockerfile allows users to create custom im...

Detailed explanation of asynchronous programming knowledge points in nodejs

Introduction Because JavaScript is single-threade...