Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Analysis of Nginx installation example under Linux centos7 Environment

Shulou Source: shulou.com Published: 2022-05-31 12:27:03 09月19日 Update

This article introduces the relevant knowledge of "Nginx installation instance analysis under Linux centos7 environment". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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

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

Mkdir nginx-src & & cd nginx-src

Of course, you can also download the nginx installation package by running the following command under linux

Wget http://nginx.org/download/nginx-1.5.9.tar.gz

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

Tar-zxvf nginx-1.5.9.tar.gz

3. Delete installation package file command

Rm-f nginx-1.5.9.tar.gz

4. Configure, install and run commands

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

Maybe it is a hint that the package is missing:

. / 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 (need to run under the network and be a super administrator)

Yum-y install pcre-develyum-y install openssl openssl-devel

To switch to root Super Admin status: su

Reconfigure now

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

If the reconfiguration is not successful, you need to install gcc

Yum-y install gcc

Configure again after installing gcc

5. Compile command

Make

6. Installation command

Make install

7. After installation, start nginx

Cd / usr/local/nginx/sbin

. / nginx

If the startup is not successful, it may be caused by a firewall problem.

At this point, you need to turn off the firewall.

Systemctl stop firewalld.service

8. Visit nginx

Http://ip address

9. If you want to simplify the configuration file

Reload the configuration file

Run the command: nginx-s reload

To the blogger, I successfully installed the nginx server under linux centos7.

And has successfully accessed nginx through the ip address on the browser.

This is the end of the content of "Nginx installation example Analysis in Linux centos7 Environment". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Command configuration file run success instance instance analysis environment analysis content address more directory knowledge administrator identity problem firewall management fire prevention Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei Docker OPPO Reno macOS