First, download and install Nginx
Nginx's official website is http://sysoev.ru/nginx/, the English homepage for http://nginx.net, where you can get the latest version of Nginx information. Nginx has three versions: stable, development, and history stable. Development updates are faster, contain the latest features and fixes for bugs, but may also encounter new bugs that, once the update is stabilized, will be added to the stable branch. However, some new features may not necessarily be added to the old stable version. Stable versions are slower to update, but fewer bugs, and are preferred as production environments, so it is generally recommended that you use a stable version. The historical stable version of the previous stable version of the rollup, does not contain the latest features.
Here, select the current stable version nginx-0.7.65 as an Introduction object to begin the introduction of the compile installation. Before installing Nginx, make sure that the GCC, openssl-devel, Pcre-devel, and Zlib-devel software libraries are installed on the system.
The Linux development library is installed by hand when installing the system, GCC, Openssl-devel, zlib-devel three software libraries can choose to install directly from the installation disc, and the Pcre-devel library is not on the system CD by default. So here is an introduction to the Pcre-devel library.
Second, the installation of Nginx required Pcre-devel Library
The Pcre library is installed to enable Nginx to support HTTP Rewrite modules. The following is the installation process as follows.
[Root@localhost home]# tar zxvf pcre-8.02.tar.gz
[root@localhost home]# cd pcre-8.02
[root@localhost pcre-8.02 ]#./configure
[root@localhost pcre-8.02] #make
[root@localhost pcre-8.02] #make Install
Third, start installation Nginx
The installation of Nginx is very simple. By default, a compiled installation of Nginx contains most of the available modules. You can use the "./configure--help" option to set up the usage of individual modules, such as for unwanted http_ssi modules, which can be closed by "--without-http_ssi_module", and, if necessary, "Http_perl module, you can install this module by using the "--with-http_perl_module" method. The following is the installation process:
[Root@localhost home]# tar zxvf nginx-0.7.65.tar.gz
[root@localhost home] #cd nginx-0.7.65
[ Root@localhostnginx-0.7.65]#./configure \
--with-http_stub_status_module --prefix=/opt/nginx
[ Root@localhost nginx-0.7.65] #make
[root@localhost nginx-0.7.65] #make Install
In the Configure option above, "--with-http_stub_status_module" can be used to enable the Nginxstatus function of Nginx to monitor the current state of the Nginx.
At this point, Nginx has been installed.
Iv. nginx configuration file structure
The Nginx configuration file is a plain text file, which is generally located in the Conf directory of the Nginx installation directory, and the entire configuration file is organized in block form. Each block is generally represented by a brace "{}", and the block can be divided into layers, with the main command at the top level in the entire configuration file, the events, HTTP, and so on below the main layer, and the server layer in the HTTP layer, which is the server The Block,server block can also be divided into location layers, and a server block can contain multiple location blocks.
A complete configuration file structure is shown in the following figure.
After you understand the configuration file structure, you are ready to start configuring and debugging Nginx.
This article is from the "Technology Achievement Dream" blog, please be sure to keep this source http://ixdba.blog.51cto.com/2895551/778469
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/