Nginx is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP proxy server. Nginx compiler installation is relatively simple, the difficulty lies in the configuration. Here is the NIGNX 0.8.54 compilation installation and simple configuration notes.
First, preparation work 1.1, installation of OpenSSL
OpenSSL version: openssl-1.0.0c (Installation method)
1.2. Prepare Pcre Library
Pere is designed to allow Nginx to support regular expressions. Just prepared, not installed, to avoid errors in 64-bit systems.
1.
wget
ftp
://
ftp
.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.11.
tar
.gz
2.
tar
-zxf pcre-8.11.
tar
.gz
1.3. Prepare Zlib Library
It is also only prepared, not installed, to avoid errors in 64-bit systems.
1.
wget http://zlib.net/zlib-1.2.5.
tar
.gz
2.
tar
-zxf zlib-1.2.5.
tar
.gz
Second, compile and install Nignx2.1, download, create temp directory
1.
wget http://nginx.org/download/nginx-0.8.54.
tar
.gz
2.
tar
-zxf nginx-0.8.54.
tar
.gz
3.
cd
nginx-0.8.54
4.
mkdir
-p /var/tmp/nginx
2.2. Compiling and installing
Detailed compilation configuration options See "nginx compilation parameter Resolution"
1.
./configure --prefix=/usr/
local
/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-pcre=../pcre-8.11 --with-zlib=../zlib-1.2.5 --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
make
&&
make
install
2.
ln
-s/usr/
local
/nginx/sbin/nginx/usr/sbin/
--prefix #nginx安装目录, default in/usr/local/nginx
--pid-path #pid问件位置, default in Logs directory
--lock-path #lock问件位置, default in Logs directory
--with-http_ssl_module #开启HTTP the 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
2.3, boot from the Nginx script
1.
wget http://small-script.googlecode.com/files/nginx
2.
chmod
755 nginx
3.
mv
nginx /etc/init.d/
4.
update-rc.d nginx defaults
Three, NIGNX configuration
1. Change "root html;" To your website directory, such as "root/home/wwwroot;"
2, support PHP, the "location ~ \.php$" in the field of all the # comments removed.
3, smooth restart, "nginx-s Reload"
Four, nginx configuration reference
1. Nginx's Chinese Wiki
English is not good OK, everything starts here.
2, "real Nginx: Replace Apache's high-performance Web server" (PDF download)
Should be the most authoritative book in the country, including Nginx all aspects, read it can let you take a lot less detours.
3. Nginx Instruction Index
Don't understand other people's profiles? Here "ctrl+f" search it, you find the answer.
4, some optimization of nginx (breakthrough 100,000 concurrency)
CPU, memory Strong can try, the same idea, instead of the nginx can be optimized to low memory consumption.
5, Nginx 0.8.x + PHP 5.2.13 (FastCGI) build more than Apache 10 times times the Web server
Classic articles, suggested from the last look, the previous ignore
6, Nginx Multi-virtual host configuration
As the name implies, the way to add multiple virtual hosts is to add multiple server field implementations.
7, Nginx Open Directory browsing function
Nginx default is not allowed to list the entire directory, this is a very useful tips.
......
Linux compiles and installs Nginx from source code