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

Introduction to Nginx regular expression related parameters and rules

Preface Recently, I have been helping clients con...

Some summary of html to pdf conversion cases (multiple pictures recommended)

Due to work requirements, I recently spent some t...

JavaScript implements page scrolling animation

Table of contents Create a layout Add CSS styles ...

VM VirtualBox virtual machine mount shared folder

One environment Install VMware Tools on CentOS 7 ...

MySQL 8.0.12 Simple Installation Tutorial

This article shares the installation tutorial of ...

Examples of using html unordered list tags and ordered list tags

1. Upper and lower list tags: <dl>..</dl...

9 super practical CSS tips to help designers and developers

A web designer's head must be filled with a lo...

Specific method of viewing user authorization information in mysql

Specific method: 1. Open Command Prompt 2. Enter ...

CSS3 realizes bouncing ball animation

I usually like to visit the special pages or prod...

MySQL master-slave data is inconsistent, prompt: Slave_SQL_Running: No solution

This article uses an example to describe the solu...

CSS to achieve compatible text alignment in different browsers

In the front-end layout of the form, we often nee...

Design and implementation of Vue cascading drop-down box

Table of contents 1. Database design 2. Front-end...

Responsive layout summary (recommended)

Basic knowledge of responsive layout development ...