How to install Nginx in a specified location in Centos system

How to install Nginx in a specified location in Centos system

How to install Nginx in a specified location in Centos system? PrefaceRequirements analysisInstallation processEnvironment preparationInstall NginxRequired compilation and dependent librariesInstall OpenSSL libraryInstall PCRE libraryInstall Zlib libraryInstall NginxStart Nginx for verificationSprinkle flowers! Nginx installed successfully!

Preface

Because I didn’t have the habit of blogging before, many things were easily forgotten over time. Starting today, I will share the problems encountered at work and the solutions on Ctrip Blog. I hope to make progress together with all the programmers.

Demand Analysis

It is convenient for operation and maintenance personnel to install and deploy it during work. The project manager requires that the front-end package and the web server be packaged and stored uniformly.
This enables operation and maintenance personnel to complete front-end deployment using a simple tar package decompression command. ,
Therefore, you need to install Nginx in the specified location. This article will install nginx in the app/Nginx folder in the root directory as an example

Installation Process

Environment Preparation

Operating system Centos7.X
Dependent components for normal network connection: OpenSSL , PCRE , and Zlib libraries must be installed on the system.

Install the compilation and dependent libraries required by Nginx Install the OpenSSL library

# yum install openssl-devel when Centos connects to the network
# When Centos has no network connection# Go to https://www.openssl.org/source/ to download the tar package and upload it to Centos /app/Nginx# Decompress it tar -zxvf openssl-1.0.1t.tar.gz
# /app/Nginx/openssl-1.0.1t.tar.gz Remember this installation directory as it will be used later

Install PCRE Library

# yum install pcre-devel when Centos connects to the network
# When Centos has no network connection # Go to https://ftp.pcre.org/pub/pcre/ and download the tar package and upload it to Centos /app/Nginx # Decompress it tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40 # Enter the folder # Compile command line ./configure
 make && make install 
# /app/Nginx/pcre-8.40 Remember this installation directory as it will be used later

Install Zlib Library

# yum install zlib-devel when Centos connects to the network
# When Centos has no network connection# Go to https://www.zlib.net/ to download the tar package and upload it to Centos /app/Nginx# Decompress it tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11 # Enter the folder # Compile command line ./configure
 make && make install 
# /app/Nginx/zlib-1.2.11.tar.gz Remember this installation directory as it will be used later

Install Nginx

# Download the source package when Centos connects to the network wget http://nginx.org/download/nginx-1.16.1.tar.gz
# When Centos has no network connection# Go to https://nginx.org/en/download.html to download the tar package and upload it to Centos /app/Nginx# Decompress it tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1 # Enter the folder # Set constants:
./configure \
--prefix=/app/Nginx/ \
--sbin-path=/app/Nginx/nginx \
--conf-path=/app/Nginx/nginx.conf \
--pid-path=/app/Nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=/app/Nginx/pcre-8.40 \ # The location of the pcre just installed --with-zlib=/app/Nginx/zlib-1.2.11 \ # The location of the zlib just installed --with-openssl=/app/Nginx/openssl-1.0.1t \ # The location of the openssl just installed# Compile command line make && make install 
test -d # Important!!! If not executed, the real nginx file will not be created

Start Nginx for verification

# Start Nginx
cd /app/Nginx 
./nginx

Use a browser to access the server's IP address if the port number has been reconfigured. Then visit the IP address: port number. If this interface appears, it means that Nginx is installed successfully.

insert image description here

Sprinkle flowers! Nginx installed successfully!

This is the end of this article about how to install Nginx in a specified location on Centos. For more information about how to install Nginx in a specified location on Centos, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Install and configure IIS + MySQL + nginx + php7.1.7 under Win10
  • How to install nginx on win10
  • How to install Nginx in Docker
  • Nginx installation error solution
  • How to install php7 + nginx environment under centos6.6
  • Nginx installation detailed tutorial
  • How to install PHP7.4 and Nginx on Centos
  • Detailed tutorial for installing nginx on centos8 (picture and text)
  • Detailed explanation of nginx installation, deployment and usage on Linux
  • Correct steps to install Nginx in Linux
  • The process of installing and configuring nginx in win10

<<:  MySQL database backup and recovery implementation code

>>:  webpack -v error solution

Recommend

MySQL database master-slave configuration tutorial under Windows

The detailed process of configuring the MySQL dat...

Detailed explanation of CSS style cascading rules

CSS style rule syntax style is the basic unit of ...

Methods and techniques for quickly displaying web page images

1. Use .gifs rather than .jpgs. GIFs are smaller ...

Solution to inserting a form with a blank line above and below

I don't know if you have noticed when making a...

Three common ways to embed CSS in HTML documents

The following three methods are commonly used to d...

Chinese website user experience rankings

<br />User experience is increasingly valued...

3D tunnel effect implemented by CSS3

The effect achievedImplementation Code html <d...

Introduction to 10 Hooks in React

Table of contents What is ReactHook? React curren...

What to do if the container started by docker run hangs and loses data

Scenario Description In a certain system, the fun...

MySQL 5.7 deployment and remote access configuration under Linux

Preface: Recently I am going to team up with my p...

Detailed explanation of using JavaScript WeakMap

A WeakMap object is a collection of key/value pai...

A brief talk about calculated properties and property listening in Vue

Table of contents 1. Computed properties Syntax: ...

How to use VLAN tagged Ethernet card in CentOS/RHEL system

In some scenarios, we want to assign multiple IPs...

Sample code for modifying the input prompt text style in html

On many websites, we have seen the input box disp...