In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "Linux installation nginx instance code analysis", 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 installation nginx instance code analysis"!
Linux is 64-bit Centos.
profile
1. Linux installation software common methods
RPM (or pkg) installation, similar to the Windows installer, is a precompiled program.
Generic parameter compilation used, configuration parameters not optimal
Less controllable, such as custom installation of program-specific components
Usually, there are complex dependencies between installation packages, and the operation is more complicated.
Simple installation, low error rate
2. yum (or apt-get) installation, improved rpm, automatic networking download installation package, automatic dependency management
3, compile and install (the way in various linux distributions is not much different)
Strong controllability, config parameters can be optimized according to the current system environment, customized components and installation parameters
Error prone, slightly more difficult
Second, nginx compilation and installation
Check and install dependencies
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、configure
3、make && make install
The detailed steps are as follows
Step 1: download the corresponding version from (or wget directly on linux with the command download)
Step 2: Decompress tar -zxvf nginx-1.9.9.tar.gz
Step 3: Set the configuration information./ configure --prefix=/usr/local/nginx, or do not perform this step, directly default configuration
Step 4:
make compilation (the process of making is to turn source files written in various languages into executable files and various library files)
make install (make install copies the compiled executable files and library files to the appropriate location)
When configuring the information, that is, in the third step, an error occurred:
The error is: ./ configure: error: the http rewrite module requires the pcre library.
Install pcre-devel to solve problems
yum -y install pcre-devel
There may also be:
Error message: ./ configure: error: the http cache module requires md5 functions
from openssl library. you can either disable the module by using
--without-http-cache option, or install the openssl library into the system,
or build the openssl library statically from the source with nginx by using
--with-http_ssl_module --with-openssl= options.
Solution:
yum -y install openssl openssl-devel
Starting and closing nginx under linux after installation:
startup operation
The requested URL/usr/local/nginx/sbin/nginx was not found on this server.
stop operation
Stop is done by signaling the nginx process (see linux chapter for what signals are)
Step 1: Query nginx main process number
ps -ef | grep nginx
Look for the master process in the process list, and its number is the master process number.
Step 2: Send the signal
Stop NGINX:
kill -quit main process number
Quickly stop nginx:
kill -term Main process number
Forcing nginx to stop:
pkill -9 nginx
In addition, if the pid file storage path is configured in nginx.conf, the file stores the nginx main process number. If it is not specified, it is placed in the nginx logs directory. With the pid file, we do not need to query the main process number of nginx first, but send a signal directly to nginx, the command is as follows:
kill -Signal type '/usr/local/nginx/logs/nginx.pid'
graceful restart
If you change the configuration, you need to restart nginx. Do you need to close nginx first and then open it? No, you can send a signal to nginx to restart smoothly.
Smooth restart command:
kill -hup live title or process number file path
or use
/usr/local/nginx/sbin/nginx -s reload
Note that after modifying the configuration file, it is best to check whether the modified configuration file is correct, so as not to affect the stable operation of the server after restarting nginx errors. judgment
Nginx configuration is correct command is as follows:
nginx -t -c /usr/local/nginx/conf/nginx.conf
or
/usr/local/nginx/sbin/nginx -t
As shown below:
Down to configure environment variables
Add to/etc/profile:
export nginx_home=/usr/local/nginx
export path=path:path:nginx_home/sbin
Preservation,
Execute source /etc/profile to make the configuration file take effect.
Execute nginx -v, you can see the version, indicating that nginx installation is successful
At this point, I believe that everyone has a deeper understanding of "Linux installation nginx instance code analysis", 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.
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.