Installing Nginx
Yum installation
Reference http://nginx.org/en/linux_packages.html
Compile and install Nginx
The system first installs the gcc* package and some dependent packages
[email protected] tool]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[Email protected] tool]# tar XF nginx-1.8.0.tar.gz-c/usr/local/src/
[Email protected] tool]# cd/usr/local/src/nginx-1.8.0/
[Email protected] nginx-1.8.0]#
Note: Each version is different, the module installed by default may vary
For details, refer to the official website:
http://nginx.org/en/docs/configure.html
Or
[email protected] nginx-1.8.0]#./configure–help Select the required modules according to requirements
[email protected] nginx-1.8.0]# Yum install gcc* pcre pcre-devel OpenSSL openssl-devel zlibzlib-devel–y
[Email protected] nginx-1.8.0]# useradd nginx-s/sbin/nologin–m
[Email protected] nginx-1.8.0]#/configure--prefix=/usr/local/webserver/nginx--with-http_ssl_module--with-http_ Flv_module--with-http_gunzip_module--with-http_stub_status_module
[[email protected] nginx-1.8.0]# make && make install
MAKE[1]: Leaving directory '/usr/local/src/nginx-1.8.0 '
View Nginx-Installed modules
[Email protected] Nginx-1.8.0]#/usr/local/webserver/nginx/sbin/nginx-v
Nginx version:nginx/1.8.0
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
Built with OpenSSL 1.0.1e-fips 2013
TLS SNI Support Enabled
Configure arguments:--prefix=/usr/local/webserver/nginx--with-http_ssl_module--with-http_flv_module--with-http_ Gunzip_module--with-http_stub_status_module
Nginx compile modules that need to be opened according to business needs
--with-http_ssl_module Enable Ngx_http_ssl_module
--with-http_spdy_module Enable Ngx_http_spdy_module
--with-http_realip_module Enable Ngx_http_realip_module
--with-http_addition_module Enable Ngx_http_addition_module
--with-http_xslt_module Enable Ngx_http_xslt_module
--with-http_image_filter_module Enable Ngx_http_image_filter_module
--with-http_geoip_module Enable Ngx_http_geoip_module
--with-http_sub_module Enable Ngx_http_sub_module
--with-http_dav_module Enable Ngx_http_dav_module
--with-http_flv_module Enable Ngx_http_flv_module
--with-http_mp4_module Enable Ngx_http_mp4_module
--with-http_gunzip_module Enable Ngx_http_gunzip_module
--with-http_gzip_static_module Enable Ngx_http_gzip_static_module
--with-http_auth_request_module Enable Ngx_http_auth_request_module
--with-http_random_index_module Enable Ngx_http_random_index_module
--with-http_secure_link_module Enable Ngx_http_secure_link_module
--with-http_degradation_module Enable Ngx_http_degradation_module
--with-http_stub_status_module Enable Ngx_http_stub_status_module
Nginx How to add a module that is not compiled
Re-compiling
[Email protected] nginx-1.8.0]#/configure--prefix=/usr/local/webserver/nginx--with-http_ssl_module--with-http_ Flv_module--with-http_gunzip_module--with-http_stub_status_module--with-http_realip_module--with-http_flv_ Module && make
[[email protected] nginx-1.8.0]# ls
Auto changes changes.ru conf Configure contrib HTML LICENSE Makefile man OBJS README src
#make after completion will generate a OBJS directory will be more than one nginx, he is a newly translated Nginx program, only need to copy the Objs/nginx to/usr/local/webserver/nginx/sbin/cover the original Nginx program can be
If the Nginx is running at this time will be the nginx shutdown, and then back up the original Nginx program
[Email protected] objs]# Cp/usr/local/webserver/nginx/sbin/nginx/usr/local/webserver/nginx/sbin/nginx.bak
Copy the new Nginx program to cover the original Nginx
[email protected] nginx-1.8.0]# CP Objs/nginx/usr/local/webserver/nginx/sbin/nginx
Cp:overwrite '/usr/local/webserver/nginx/sbin/nginx '? Y
View the compilation module
[Email protected] Nginx-1.8.0]#/usr/local/webserver/nginx/sbin/nginx-v
Nginx version:nginx/1.8.0
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
Built with OpenSSL 1.0.1e-fips 2013
TLS SNI Support Enabled
Configure arguments:--prefix=/usr/local/webserver/nginx--with-http_ssl_module--with-http_flv_module--with-http_ Gunzip_module--with-http_stub_status_module--with-http_realip_module--with-http_flv_module
Installation of third-party modules
Https://www.nginx.com/resources/wiki/modules/index.html
This article from the "Small Rookie" blog, reproduced please contact the author!
Nginx Compilation and addition of non-compiled modules