Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The installation and configuration method of nginx

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install and configure nginx". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to install and configure nginx.

1. Preface

The source code installation is used for this installation. The main resource packages are downloaded from the official website, while the secondary dependencies are installed using yum. This article only deals with the installation of nginx, not the configuration of nginx. This article does not cover how nginx accesses php. This tutorial is purely for installation, does not involve any important knowledge points, and is suitable for all ages.

2. Installation steps

Nginx official website

2.1.download nginx

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

Download the pcre installation package

Wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz

This package does not need to be installed, it is just a medium

2.3.Unpack nginx and pcre

Tar zxvf nginx-1.12.0.tar.gz

Tar zxvf pcre-8.39.tar.gz

2.4. Install dependency packages

Yum install-y gcc gcc-c++ zlib-devel

2.5.Generate Makefile file

Cd nginx-1.12.0

. / configure-- prefix=/usr/local/nginx (installation directory)-- with-pcre=../pcre-8.39/ (pcre relative directory)

The results are as follows:

2.6. Compile and install

Make & & make install

The results are as follows:

At this point, the nginx installation is complete.

3. Start nginx

/ usr/local/nginx/sbin/nginx

Check the running status via ps aux | grep nginx

At this point, the nginx starts normally.

4. Open 80 ports for external access

If you only run without opening the port, the browser is inaccessible.

Firewall-cmd-zone=public-add-port=80/tcp-permanent

Successful opening of port 80

To open the play port, you need to restart the firewall.

Systemctl restart firewalld.service

At this point, you can reopen the browser and access it.

When you visit the browser, the interface above indicates that nginx has been installed.

At this point, I believe you have a deeper understanding of the "method of installation and configuration of nginx". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report