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

Installation steps and problem solving methods of nginx in linux centos7 Environment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "linux centos7 environment nginx installation steps and problem solving methods", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "Linux centos7 environment nginx installation steps and problem solving"!

The steps to install nginx in linux centos are as follows:

One. preparations

[root@iz8vb5upytqx83z3r1vpd2z ~]# cat /etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

This is my server version.

Before starting, please confirm whether gcc g++ development library is installed, default has been installed.

Centos platform installation gcc

yum -y install gcc automake autoconf libtool make

Install g++:

yum install gcc gcc-c++

Recommendations:

Create nginx in/usr/local/src/directory

The requested URL/usr/local/was not found on this server.

Since I first configured an nginx in/usr/local/, which caused various problems in the nginx directory, the configuration certificate could not take effect. Here is an explanation.

II. Installation of PCRE Library

pcre download address: sourceforge.net/projects/pcre/

Or download it with weget (current version pcre2-10.33.tar.gz)

Interested parties can try the latest version.

Compile and install PCRE packages:

cd /usr/local/src

tar -zxvf pcre-8.37.tar.gz

cd pcre-8.34

./ configure

make

make install

3. Install zlib library

Go to http://www.zlib.net/ Discover

Current release:

zlib 1.2.11

The latest version is 1.2.11.

Download, compile and install the zlib package using the following command:

cd /usr/local/src

wget http://zlib.net/zlib-1.2.11.tar.gz (or download and upload the service yourself)

tar -zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./ configure

make

make install

4. Install openssl (some vps are not installed by default)

cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz

./ configure

make

make install

5. Install nginx

Note the difference between the versions: Nginx official website provides three types of versions

1. Mainline version: Mainline is the version of Nginx that is currently the main work, which can be said to be the development version.

Stable version: the latest stable version, the version recommended for use in production environments

Legacy versions: stable versions of legacy older versions

Nginx download access address: nginx.org/en/download.html

Because the referenced blog is version 1.1.10, the installation certificate is incorrect, so remind everyone to install nginx or look at the latest official stable version.

The latest stable version used in this article is nginx-1.16.0

cd /usr/local/src

wget http://nginx.org/download/nginx-1.1.10.tar.gz

tar -zxvf nginx-1.1.10.tar.gz

cd nginx-1.1.10

./ configure

make

make install

This note is that if you forget--with-http_ssl_module, you need to recompile it. For specific reference:

https://blog.csdn.net/odeng888/article/details/88591253

If:

No rule to make target `build', needed by ` default'. Stop.

Solution:

yum -y install openssl openssl-devel

6. Start nginx

Because apeache may occupy port 80, apeache port should not be modified as much as possible, we choose to modify nginx port. linux modification path/usr/local/nginx/conf/nginx.conf, Windows installation directory\conf\nginx.conf Change the port to 8090 and localhost to your server IP address.

cd /usr/local/nginx/conf

vi server.xml

Modify port number:

Seven, nginx restart, shutdown, start

1. start

Startup code format: nginx installation directory address-c nginx configuration file address

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

2. Close nginx

ps -ef grep nginx

kill -9 pid (process number)

Verify that the nginx configuration file is correct

Method 1: Enter the nginx installation directory sbin and enter the command./ nginx -t

nginx.conf syntax is ok

nginx.conf test is successful

The configuration file is correct!

4, Restart Nginx service

Method 1: Enter the nginx executable directory sbin and enter the command./ nginx -s reload

Access ip: port

Welcome to nginx ! success.

Attention to opening firewall ports:

1. View status: iptables -L -n

Direct configuration: /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT

service iptables save

5. Restart firewall: service iptables restart

Restart firewall

systemctl stop iptables

systemctl start iptables

systemctl restart iptables

At this point, I believe that everyone has a deeper understanding of the "linux centos7 environment nginx installation steps and problem resolution", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to 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

Internet Technology

Wechat

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

12
Report