Analysis of Nginx installation examples in Linux centos7 environment

王林
Release: 2023-05-28 14:32:25
forward
933 people have browsed it

1. First go to the nginx official website to download the nginx installation package

After downloading, you will see a file similar to the following

Linux centos7环境下Nginx安装实例分析

Create the nginx-src directory And go to the nginx-src directory and run the following command:

mkdir nginx-src && cd nginx-src
Copy after login

Of course, you can also run the following command under Linux to download the nginx installation package

wget http://nginx.org/download/nginx-1.5.9.tar.gz
Copy after login

Linux centos7环境下Nginx安装实例分析

2. Unzip the nginx-1.5.9.tar.gz file

tar -zxvf nginx-1.5.9.tar.gz
Copy after login

Linux centos7环境下Nginx安装实例分析

##3. Delete the installation package file command

rm -f nginx-1.5.9.tar.gz
Copy after login

Linux centos7环境下Nginx安装实例分析

4. Configure installation and run command

cd nginx-1.5.9/

./configure --prefix=/usr/local/nginx
Copy after login

Linux centos7环境下Nginx安装实例分析

Maybe

prompts missing package:

./configure: error: the http rewrite module requires the pcre library.

You can either disable the module by using --without-http_rewrite_module

option, or install the pcre library into the system, or build the pcre library

statically from the source with nginx by using --with-pcre= option.

Install pcre-devel to solve the problem (needs to be running under the network and Is the super administrator identity)

yum -y install pcre-devel
yum -y install openssl openssl-devel
Copy after login

Linux centos7环境下Nginx安装实例分析

To switch to the root super administrator identity: su

Linux centos7环境下Nginx安装实例分析

Linux centos7环境下Nginx安装实例分析

Reconfigure now

./configure --prefix=/usr/local/nginx

If the reconfiguration fails, you need to install gcc

yum –y install gcc
Copy after login

Linux centos7环境下Nginx安装实例分析

After installing gcc, configure it again

Linux centos7环境下Nginx安装实例分析

5. Compile command

make

Linux centos7环境下Nginx安装实例分析

6. Installation command

make install

Linux centos7环境下Nginx安装实例分析

7. After installation, start nginx

cd /usr/local/nginx/sbin

./nginx

Linux centos7环境下Nginx安装实例分析

If the startup fails, it may be caused by a firewall problem

At this time Need to turn off the firewall

systemctl stop firewalld.service

Linux centos7环境下Nginx安装实例分析

8. Visit nginx

http://ip address

Linux centos7环境下Nginx安装实例分析

9. If you want to streamline the configuration file

Reload the configuration file

Run the command: nginx -s reload

Go to blog here I have successfully installed the nginx server

under linux centos7 and have successfully accessed nginx through the IP address on the browser.

The above is the detailed content of Analysis of Nginx installation examples in Linux centos7 environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!