I. Preparation before installation
1. Get System Information
| The code is as follows |
Copy Code |
# Cat/etc/redhat-release
CentOS Release 6.5 (Final)
# uname-p
x86_64
|
From the above, the current system: 64-bit CentOS 6.5.
2. Installation Base Package
| The code is as follows |
Copy Code |
|
# yum Install gcc
# yum Install wget |
Second, the installation of Nginx Module Base Library
1, the installation of HTTP rewrite (pseudo-static) module required Pcre Library.
| The code is as follows |
Copy Code |
# yum Install Pcre-devel
|
2, the installation of HTTP gzip (compression) module required Zlib Library.
| The code is as follows |
Copy Code |
|
# yum Install Zlib-devel |
Third, download the source package
Download the source package from Nginx website.
| The code is as follows |
Copy Code |
|
# CD/USR/LOCAL/SRC
# wget http://nginx.org/download/nginx-1.4.7.tar.gz
# tar ZXVF nginx-1.4.7.tar.gz |
Iv. Compiling and installing Nginx
| The code is as follows |
Copy Code |
|
# CD nginx-1.4.7
#./configure--prefix=/usr/local/nginx
# make
# make Install |
Five, start Nginx
| The code is as follows |
Copy Code |
|
#/usr/local/nginx/sbin/nginx
Www.111cn.net |
Stop Nginx Command:
| The code is as follows |
Copy Code |
|
#/usr/local/nginx/sbin/nginx-s quit |
Reboot Nginx Command:
| The code is as follows |
Copy Code |
|
#/usr/local/nginx/sbin/nginx-s Reload |
Six, enter the source directory, to configure:
| The code is as follows |
Copy Code |
|
./configure
--prefix=/opt/nginx
--sbin-path=/opt/nginx/sbin/nginx
--conf-path=/opt/nginx/conf/nginx.conf
--error-log-path=/opt/nginx/logs/error.log
--http-log-path=/opt/nginx/logs/access.log
--http-client-body-temp-path=/opt/nginx/body
--http-proxy-temp-path=/opt/nginx/proxy
--http-fastcgi-temp-path=/opt/nginx/fastcig
--http-uwsgi-temp-path=/opt/nginx/uwsgi
--http-scgi-temp-path=/opt/nginx/scgi
--pid-path=/opt/nginx/logs/nginx.pid
--lock-path=/opt/nginx/lock/nginx.lock
--user=nobody
--group=nobody
--with-http_ssl_module
--with-http_realip_module
--with-http_flv_module
--with-http_mp4_module
--with-rtsig_module
--with-file-aio
--with-ipv6
--with-http_addition_module
--with-http_xslt_module
--with-http_image_filter_module
--with-http_geoip_module
--with-http_sub_module
--with-http_dav_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_degradation_module
--with-http_stub_status_module
--with-debug |
Seven, can refer to: Nginx compilation parameter parsing
–prefix #nginx安装目录, default in/usr/local/nginx
–pid-path #pid问件位置, default in Logs directory
–lock-path #lock问件位置, www.111cn.net default in Logs directory
–with-http_ssl_module #开启HTTP SSL module to support HTTPS requests.
–with-http_dav_module #开启WebDAV扩展动作模块, you can specify permissions for files and directories
–with-http_flv_module #支持对FLV文件的拖动播放
–with-http_realip_module #支持显示真实来源IP地址
–with-http_gzip_static_module #预压缩文件传前检查 to prevent files from being repeatedly compressed
–with-http_stub_status_module #取得一些nginx的运行状态
–with-mail #允许POP3/IMAP4/SMTP Agent Module
–with-mail_ssl_module #允许POP3/IMAP/SMTP can use Ssl/tls
–with-pcre=.. /pcre-8.11 #注意是未安装的pcre路径
–with-zlib=.. /zlib-1.2.5 #注意是未安装的zlib路径
–with-debug #允许调试日志
–http-client-body-temp-path #客户端请求临时文件路径
–http-proxy-temp-path #设置http Proxy Temp file path
–http-fastcgi-temp-path #设置http fastcgi Temporary file path
–http-uwsgi-temp-path=/var/tmp/nginx/uwsgi #设置uwsgi Temporary file path
–http-scgi-temp-path=/var/tmp/nginx/scgi #设置scgi Temporary file path