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. Installation Process Environment Preparation Operating system Centos7.X 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. 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:
|
<<: MySQL database backup and recovery implementation code
Preface Recently, I have been helping clients con...
Due to work requirements, I recently spent some t...
Table of contents Create a layout Add CSS styles ...
One environment Install VMware Tools on CentOS 7 ...
This article shares the installation tutorial of ...
background This article mainly tests whether the ...
1. Upper and lower list tags: <dl>..</dl...
A web designer's head must be filled with a lo...
Specific method: 1. Open Command Prompt 2. Enter ...
I usually like to visit the special pages or prod...
This article uses an example to describe the solu...
In the front-end layout of the form, we often nee...
Table of contents 1. Database design 2. Front-end...
Basic knowledge of responsive layout development ...
Problem: The PHP program on one server cannot con...