Detailed steps to install Nginx on Linux

Detailed steps to install Nginx on Linux

1. Nginx installation steps

1.1 Official website introduction

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

insert image description here

1.2 Upload the installation package

Upload to the specified directory /usr/local/src

insert image description here

1.3 Unzip the Nginx compressed file

insert image description here

1. Move the installation directory to the specified file

mv nginx-1.19.4.tar.gz software/

2. Modify the file name

 mv nginx-1.19.4 nginx

1.4 About nginx directory description

insert image description here

1.5 Install nginx server

Note: Execute the following command in the source file

./configure

insert image description here

Direct results:

insert image description here

make

insert image description here

make install

insert image description here

1.6 nginx command description

Description: nginx working directory description path:

insert image description here

Order:
1. Windows command:
1. Start command: start nginx
2. Restart command: nginx -s reload
3. Shutdown command: nginx -s stop

2. Linux commands:
				1. Start command: ./nginx
				2. Restart command: ./nginx -s reload
				3. Shutdown command: ./nginx -s stop

1.7 Modify the nginx configuration file

insert image description here

Requirements:
1. Implement image reverse proxy
2. Implement tomcat load balancing

Specific implementation:
After the modification is complete, restart the nginx server.

#Configure the image proxy server http://image.jt.com:80
	server {
		listen 80;
		server_name image.jt.com;

		location / {
			#root D:/JT-SOFT/images;
			root /usr/local/src/images;
		}	
	}

	#Configure the product backend server server{
		listen 80;
		server_name manage.jt.com;

		location / {
			#Proxy real server address #proxy_pass http://localhost:8091;
			#Map to cluster #proxy_pass http://jtWindows;
			proxy_pass http://jtLinux;
		}
	}

	#Configure the tomcat server cluster 1. Default polling strategy 2. Weight strategy 3. ip_hash strategy upstream jtWindows {
		#ip_hash; down indicates downtime backup standby machine #max_fails=1 indicates the maximum number of failures #fail_timeout=60s If access is unsuccessful, the failed machine will not be accessed again within 60 seconds server 127.0.0.1:8081 max_fails=1 fail_timeout=60s;
		server 127.0.0.1:8082 max_fails=1 fail_timeout=60s;
		server 127.0.0.1:8083 max_fails=1 fail_timeout=60s;
	}
	
	upstream jtLinux {
		server 192.168.126.129:8081;
		server 192.168.126.129:8082;
		server 192.168.126.129:8083;
	}

1.8. Modify the hosts file

Note: Since you did not purchase the domain name image/manage.jt.com, you need to modify the redirection through the hosts file.
Modify the hosts file in Windows:

# Jingtao configuration 192.168.126.129 image.jt.com

192.168.126.129 manage.jt.com

#IP domain name mapping relationship#127.0.0.1 image.jt.com

#127.0.0.1 manage.jt.com

127.0.0.1 www.jt.com

127.0.0.1 sso.jt.com

127.0.0.1 localhost

#bug missing the last letter issue

1.9 Effect display

insert image description here

This is the end of this article about the detailed steps of installing Nginx on Linux. For more information about the steps of installing Nginx on Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of nginx installation, deployment and usage on Linux
  • How to install and start nginx in Linux
  • Tutorial on installing lnmp using yum on centos7 (linux+nginx+php7.1+mysql5.7)
  • How to install Nginx under Linux (pcre and openssl)
  • Install and configure Nginx server + PHP development environment from scratch under Linux
  • Detailed explanation of nginx compilation and installation tutorial and compilation parameters under Linux

<<:  In-depth reading and practice records of conditional types in TypeScript

>>:  Html makes a simple and beautiful login page

Recommend

Linux uses iptables to limit multiple IPs from accessing your server

Preface In the Linux kernel, netfilter is a subsy...

Introduction to the use of MySQL official performance testing tool mysqlslap

Table of contents Introduction Instructions Actua...

CSS3 uses the transition property to achieve transition effects

Detailed description of properties The purpose of...

HTML form component example code

HTML forms are used to collect different types of...

Docker image creation Dockerfile and commit operations

Build the image There are two main ways to build ...

Detailed explanation of Docker container network port configuration process

Exposing network ports In fact, there are two par...

Solutions to black screen when installing Ubuntu (3 types)

My computer graphics card is Nvidia graphics card...

js to create a carousel effect

I think the carousel is a relatively important po...

vue-cropper component realizes image cutting and uploading

This article shares the specific code of the vue-...

WeChat applet implements user login module server construction

I chose node.js to build the server. Friends who ...

Solve the abnormal error when building vue environment with webpack

Table of contents First, configure package.json T...

Solution for Docker container not recognizing fonts such as Songti

Problem background: When using docker to deploy t...

CentOS7 installation zabbix 4.0 tutorial (illustration and text)

Disable SeLinux setenforce 0 Permanently closed: ...