In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to compile and install Nginx", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to compile and install Nginx"!
Preface
Because WeChat Mini Programs wants to use Https, but he cannot modify the configuration already on the cable. So the easiest way is to use nginx forwarding, use https on nginx, and then forward it to the internal server. Nginx because of its excellent performance. The memory of a 4-core 16GB can fully support millions of pv-level access per day.
Basic knowledge
Due to the use of the epoll model, Nginx requires that the kernel of linux must be above 2.6. To understand the epoll model, you can take a look at this article on Zhihu: the relationship between IO multiplexing and select,poll and epoll.
Use uname-a to view the Linux kernel version, as shown in Centos 6.5:
download
The download address of Nginx's official website is http://nginx.org/en/download.html.
There are three types of versions available on the Nginx website:
Mainline version:Mainline is the version currently being done by the main force of Nginx, which can be said to be a development version.
Stable version:*** stable Edition, recommended for production environments
Legacy versions: a stable version of the old version left over
Compilation and installation
Nginx relies on the following modules:
Gzip module requires zlib library and its development environment
Rewrite module requires pcre library and development environment
The ssl function requires the openssl library and development environment as well as the yum install-y gcc-c++ environment. takes the gzip module as an example to see if the following modules are installed:
If it is not installed, yum install zlib zlib-devel.
Make is used to compile. It reads instructions from Makefile and then compiles. Make install is used for installation, and it also reads instructions from Makefile and installs to the specified location.
The simplest way to compile and install Nginx
Tar zxvf nginx-1.10.2.tar.gz
After decompression, enter into
. / configure is used to check the installation environment of the machine. At the end of the configure phase, the following message appears:
You can see the default installation directory and some basic configurations.
Start
Nginx defaults to port 80. Before starting nginx directly, check whether port 80 is occupied, and use fuser-n tcp 80 or netstat-pan | grep: 80 to check whether port 80 is occupied. Assuming it's not occupied, go to the / usr/local/nginx (default installation directory mentioned above) directory:
Visit: http://ip:80/ to see the welcome page of nginx.
Nginx configuration
In / usr/local/nginx/conf (the default configuration), there is a nginx.conf file. The code for nginx.conf looks like this:
Delete unnecessary files. The basic file types look like this:
Notice the log configuration at the top? The configuration set at the top takes effect globally. But the submodule can overwrite it. Top log configuration:
Suppose the developer changed the nginx.conf configuration to test whether nginx.conf is legal:
Diagram of nginx profile architecture
# https
In the compilation phase, you need to compile the ssl module:. / configure-- with-http_ssl_module
Current limit
Http://nginx.org/en/docs/http/ngx_http_limit_req_module.html
Note that later configuration in Http needs to be introduced in server.
The amount of data that burst can access in a second. Burst is equivalent to an authorization token, each query per second, current burst-1, query end, burst+1
If the burst is 0, it cannot be accessed.
As you can see, it is basically returned once a second.
Instance configuration
Thank you for your 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, and the specific use needs to be verified in practice. 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.
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.