In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to compile and install nginx in the lnmp environment". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to compile and install nginx in the lnmp environment.
The linux system I use is centos7.1.
If the linux system does not have pre-installed compiler software such as gcc, you can install it using the yum source. To install nginx, you first need to install the dependent modules pcre, zlib, and openssl.
Gzip module requires zlib library
Rewrite module requires pcre library
Openssl library is required for ssl function
1. Install pcre dependencies
Download pcre-8.38 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
Decompress tar-zxvf pcre-8.38.tar.gz
Go to the unzip directory cd your directory / pcre-8.38
Compile. / configure-- prefix=/opt/project/pcre # specify the installation directory
Install make & & make install after compilation is complete
two。 Install zlib dependencies
Download zlib-1.2.11 wget
Decompress tar-zxvf zlib-1.2.11.tar.gz
Go to the unzip directory cd your directory / zlib-1.2.11
Compile. / configure-- prefix=/opt/project/zlib # specify the installation directory
Install make & & make install after compilation is complete
3. Install openssl dependencies
Download openssl-1.1.1-pre5 wget
Decompress tar-zxvf openssl-1.1.1-pre5.tar.gz
Go to the unzip directory cd your directory / openssl-1.1.1-pre5
Compile. / configure-- prefix=/opt/project/openssl # specify the installation directory
Install make & & make install after compilation is complete
4. Install the nginx service
Manually create nginx users and user groups
Groupadd nginx
Useradd nginx-g nginx-s / sbin/nologin-m
Download wget
Decompress tar-zxvf nginx-1.14.0.tar.gz
Compile
. / configure-- prefix=/opt/project/nginx-1.14 # nginx installation location
-- sbin-path=/opt/project/nginx-1.14/sbin/nginx # sets the path to the nginx executable file
-- conf-path=/opt/project/nginx-1.14/config/nginx.conf # sets the path of nginx configuration file
-- pid-path=/opt/project/nginx-1.14/logs/nginx.pid # set up the nginx.pid file
-- error-log-path=/opt/project/nginx-1.14/logs/error.log # sets the name of the primary error, warning, and diagnostic file
-- lock-path=/opt/project/nginx-1.14/logs/nginx.log\
-- http-log-path=/opt/project/nginx-1.14/logs/access.log # sets the name of the log file of the main requested http server
-- with-http_ssl_module
-- user=nginx\
-- group=nginx\
-- with-pcre=/var/software/nginx/pcre-8.38 # refers to the source path of pcre
-- with-zlib=/var/software/nginx/zlib-1.2.11 # refers to the source path of zlib
-- with-openssl=/var/software/nginx/openssl-1.1.1-pre5 # refers to the source path of openssl
Install make & & make install
After the nginx compilation and installation is complete, modify the nginx.conf
User nginx nginx
Start nginx/ opt/project/nginx/nginx
Restart nginx/ opt/project/nginx/nginx-s reload
Kill the process pkill-9 nignx
View port netstat-ano | grep 80
View the process ps-ef | grep nginx
6 >
If you can't access it, you need to turn off the firewall.
Centos7 View Firewall status
Firewall-cmd-state # running Firewall is running (not running is turned off)
Turn off the firewall
Systemctl stop firewalld.service # stop firewall
Systemctl disable firewalld.service # prevents firewall from booting
If you encounter problems during the installation process, please google yourself, because the errors encountered may be different due to differences in the system.
At this point, I believe you have a deeper understanding of "how to compile and install nginx in the lnmp environment". 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.