共计 6399 个字符,预计需要花费 16 分钟才能阅读完成。
安装 libunwind
64 位操作系统请先安装 libunwind 库,32 位操作系统不要安装。libunwind 库为基于 64 位 CPU 和操作系统的程序提供了基本的堆栈辗转开解功能,其中包括用于输出堆栈跟踪的 API、用于以编程方式辗转开解堆栈的 API 以及支持 C ++ 异常处理机制的 API。
- [root@test software]# tar zxvf libunwind-1.1.tar.gz
- [root@test software]# cd libunwind-0.99-alpha
- [root@test libunwind-0.99-alpha]# CFLAGS=-fPIC ./configure
- [root@test libunwind-0.99-alpha]# make CFLAGS=-fPIC
- [root@test libunwind-0.99-alpha]# make CFLAGS=-fPIC install
安装 google-perftools
- [root@test software]# tar -zxvf gperftools-2.1.tar.gz
- [root@test software]# cd gperftools-2.1
- [root@test gperftools-2.1]# ./configure
- [root@test gperftools-2.1]# make
- [root@test gperftools-2.1]# make install
- [root@test gperftools-2.1]# echo “/usr/local/lib” > /etc/ld.so.conf.d/usr_local_lib.conf
- [root@test gperftools-2.1]# /sbin/ldconfig
安装 nginx
- [root@test software]# tar -zxvf nginx-1.5.7.tar.gz
- [root@test software]# cd nginx-1.5.7
- [root@test nginx-1.5.7]# ./configure –prefix=/service/nginx –with-http_stub_status_module –with-google_perftools_module –with-pcre –with-http_ssl_module –lock-path=/service/nginx/nginx.lock –pid-path=/service/nginx/nginx.pid
- ……………………
- Configuration summary
- + using PCRE library: /service/pcre
- + using system OpenSSL library
- + md5: using OpenSSL library
- + sha1: using OpenSSL library
- + using system zlib library
- nginx path prefix: “/service/nginx”
- nginx binary file: “/service/nginx/sbin/nginx”
- nginx configuration prefix: “/service/nginx/conf”
- nginx configuration file: “/service/nginx/conf/nginx.conf”
- nginx pid file: “/service/nginx/nginx.pid”
- nginx error log file: “/service/nginx/logs/error.log”
- nginx http access log file: “/service/nginx/logs/access.log”
- nginx http client request body temporary files: “client_body_temp”
- nginx http proxy temporary files: “proxy_temp”
- nginx http fastcgi temporary files: “fastcgi_temp”
- nginx http uwsgi temporary files: “uwsgi_temp”
- nginx http scgi temporary files: “scgi_temp”
- [root@test nginx-1.5.7]# make
- [root@test nginx-1.5.7]# make install
测试 nginx
- [root@test sbin]# ./nginx -t
- nginx: the configuration file /service/nginx/conf/nginx.conf syntax is ok
- nginx: configuration file /service/nginx/conf/nginx.conf test is successful
- [root@test sbin]# ./nginx -v
- nginx version: nginx/1.5.7
- [root@test sbin]#
- [root@test nginx]# /service/nginx/sbin/nginx
- [root@test nginx]# netstat -lanp|grep nginx
- tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 27889/nginx
- unix 3 [] STREAM CONNECTED 54224 27889/nginx
- unix 3 [] STREAM CONNECTED 54223 27889/nginx
- [root@test nginx]# ll
- total 40
- drwx—— 2 nobody root 4096 Nov 26 21:24 client_body_temp
- drwxr-xr-x 2 root root 4096 Nov 26 21:38 conf
- drwx—— 2 nobody root 4096 Nov 26 21:24 fastcgi_temp
- drwxr-xr-x 2 root root 4096 Nov 26 21:23 html
- drwxr-xr-x 2 root root 4096 Nov 26 21:24 logs
- -rw-r–r– 1 root root 6 Nov 26 21:40 nginx.pid
- drwx—— 2 nobody root 4096 Nov 26 21:24 proxy_temp
- drwxr-xr-x 2 root root 4096 Nov 26 21:23 sbin
- drwx—— 2 nobody root 4096 Nov 26 21:24 scgi_temp
- drwx—— 2 nobody root 4096 Nov 26 21:24 uwsgi_temp
- [root@test nginx]# cat nginx.pid
- 27889
- [root@test nginx]# ps -ef|grep nginx
- root 27889 1 0 21:40 ? 00:00:00 nginx: master process /service/nginx/sbin/nginx
- nobody 27890 27889 0 21:40 ? 00:00:00 nginx: worker process
- root 27902 3729 0 21:40 pts/0 00:00:00 grep nginx
关闭 Nginx
/service/nginx/sbin/nginx -s stop
访问 81 端口显示
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
推荐阅读 :
Nginx 实现反向代理和负载均衡的配置及优化 http://www.linuxidc.com/Linux/2013-11/92909.htm
Nginx 做负载均衡报:nginx: [emerg] could not build the types_hash http://www.linuxidc.com/Linux/2013-10/92063.htm
Nginx 负载均衡模块 ngx_http_upstream_module 详述 http://www.linuxidc.com/Linux/2013-10/91907.htm
Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器 http://www.linuxidc.com/Linux/2013-10/91824.htm
Ubuntu 安装 Nginx php5-fpm MySQL(LNMP 环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm
Nginx 的详细介绍 :请点这里
Nginx 的下载地址 :请点这里