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 method of installing and configuring nginx under Centos7

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the installation and configuration method of nginx under Centos7". In daily operation, I believe many people have doubts about the installation and configuration method of nginx under Centos7. Xiaobian consulted all kinds of information and sorted out simple and easy operation methods. I hope to help you answer the doubts of "the installation and configuration method of nginx under Centos7"! Next, please follow the small series to learn together!

Description: The basic directory path of software installation: /usr/local, so when downloading software, switch to this directory and download it directly.

1. Install gcc gcc-c++ dependencies

yum install -y gcc gcc-c++

2. Download, compile and install pcre library

Switch to usr/local and execute commands

download the installation package

wget

Extract the installation package

tar -zxvf pcre-8.36.tar.gz

compile and install

cd pcre-8.36./ configuremake && make install

3. Download, compile and install ssl library

download the installation package

wget

Decompress the compressed package

tar -zxvf openssl-1.0.1j.tar.gz

compile and install

cd openssl-1.0.1j./ configmake && make install

4. Download, compile and install zlib dependency library

download the installation package

wget

Extract the installation package

tar -zxvf zlib-1.2.11.tar.gz

compile and install

cd zlib-1.2.11./ configuremake && make install

After the dependency package and environment are installed and configured, you need to install nginx

5. Installation of nginx

download the installation package

wget

Extract the installation package

tar -zxvf nginx-1.8.0.tar.gz

compile and install

cd nginx-1.8.0./ configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_modulemake && make install

(Note: In the second command of compilation:--prefix=/usr/local/nginx specifies the directory of compilation and installation. After successful compilation, the folder after nginx installation will be displayed in the/usr/local directory. You can delete the nginx-1.8.0 compilation file)

6.nginx Related Operations Command

Switch to nginx directory

cd /usr/local/nginx

execute the following command

start nginx

./ sbin/nginx

Check if nginx configuration file is correct

./ sbin/nginx -t

See the nginx configuration file accurately as illustrated in the figure

stop nginx

View the process number occupied by nginx, and then end it.

ps -ef| grep nginxkill -9 port number here, about "Centos7 nginx installation and configuration method" learning is over, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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