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

How to compile and install Nginx

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

Share

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

This article mainly explains "how to compile and install Nginx". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to compile and install Nginx".

Nginx compilation and installation system platform: CentOS 7.4Nginx version: nginx-1.12.2.tar.gzPcre version: pcre-8.42.tar.gz required dependence: gcc-c++ libtool Triple Library: zlib zlib-devel openssl openssl-devel pcre

Install compilation tools and library files

> yum install-y make zlib zlib-devel openssl openssl-devel gcc-c++ > libtool

Zlib library: the zlib library is required for ngx_http_gzip_module (gzip compression module)

Openssl library:-- with-http_ssl_module must install openssl library to support https protocol when using this module.

Second, install the pcrelibrary

Prce library:-- with-http_rewrite_module must install prce library to use this module to support address redirection, address rewriting functions, localtion instructions and regular expressions.

Wget https://sourceforge.net/projects/pcre/files/pcre/8.42/pcre-8.42.tar.gz[root@linux-node1 src] # tar xf pcre-8.42.tar.gz [root@linux-node1 src] # cd pcre-8.42 [root@linux-node1 pcre-8.42] #. / configure & & make & & make install & & echo $? [root@linux-node1 pcre-8.42] # pcre-config-version

Third, install Nginx

Wget http://nginx.org/download/nginx-1.12.2.tar.gz[root@linux-node1 /] # useradd-s / sbin/nolgoin nginx [root@linux-node1 src] # tar xf nginx-1.12.2.tar.gz [root@linux-node1 nginx-1.12.2] #. / configure-- prefix=/usr/local/nginx-- with-http_stub_status_module-- with-http_ssl_module-- with-pcre=/usr/local/src/ Pcre-8.42-- user=nginx-- group=nginx [root@linux-node1 nginx-1.12.2] # make & & make install [root@linux-node1 /] # / usr/local/nginx/sbin/nginx-V View version and compiled module [root@linux-node1 /] # / usr/local/nginx/sbin/nginx-t check whether the nginx.conf file is configured correctly nginx: the configuration file / usr/local/nginx/conf/nginx. Conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful

4. Start Nginx

[root@linux-node1 /] # / usr/local/nginx/sbin/nginx start Nginx/usr/local/nginx/sbin/nginx-s reload reload configuration file / usr/local/nginx/sbin/nginx-s reopen restart Nginx/usr/local/nginx/sbin/nginx-s stop quickly close Nginx/usr/local/nginx/sbin/nginx-s quit Close Nginx [root@linux-node1 /] # systemctl stop iptables.service [root@linux-node1 /] # systemctl stop firewalld.service thank you for reading The above is the content of "how to compile and install Nginx". After the study of this article, I believe you have a deeper understanding of how to compile and install Nginx. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

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

12
Report