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

Use of Linux crontab command

1. Command Introduction The contab (cron table) c...

Three ways to draw a heart shape with CSS

Below, we introduce three ways to draw heart shap...

How to use stored procedures in MySQL to quickly generate 1 million records

Preface When testing, in order to test the projec...

Detailed explanation of Nginx regular expressions

Nginx (engine x) is a high-performance HTTP and r...

Two ways to create SSH server aliases in Linux

Preface If you frequently access many different r...

An example of elegantly writing status labels in Vue background

Table of contents Preface optimization Extract va...

Simplify complex website navigation

<br />Navigation design is one of the main t...

What does input type mean and how to limit input

Common methods for limiting input 1. To cancel the...

Create a code example of zabbix monitoring system based on Dockerfile

Use the for loop to import the zabbix image into ...

Native JS to implement breathing carousel

Today I will share with you a breathing carousel ...

Detailed explanation of the role of the new operator in Js

Preface Js is the most commonly used code manipul...

Alibaba Cloud ESC Server Docker Deployment of Single Node Mysql

1. Download the accelerated version of msyql dock...