标签:nginx编译安装
1:操作系统环境如下
[root@zxl-nginx ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m [root@zxl-nginx ~]# uname -r 2.6.32-358.el6.x86_64 [root@zxl-nginx ~]#
2:nginx软件包版本
[root@zxl-nginx src]# ll nginx-1.8.0.tar.gz -rw-r--r-- 1 root root 832104 Dec 18 06:49 nginx-1.8.0.tar.gz
nginx1.8源码下载地址
[root@zxl-nginx src]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
3:安装nginx
[root@zxl-nginx src]# ll nginx-1.8.0.tar.gz -rw-r--r-- 1 root root 832104 Dec 18 06:49 nginx-1.8.0.tar.gz [root@zxl-nginx src]# tar fxz nginx-1.8.0.tar.gz [root@zxl-nginx src]# cd nginx-1.8.0 [root@zxl-nginx nginx-1.8.0]#./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module [root@zxl-nginx nginx-1.8.0]#make [root@zxl-nginx nginx-1.8.0]# make install
创建nginx 启动用户nginx
[root@zxl-nginx nginx-1.8.0]# useradd nginx -s /sbin/nologin -M
4:启动nginx
[root@zxl-nginx ~]# /usr/local/nginx/sbin/nginx [root@zxl-nginx ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 3250 root 10u IPv4 15355 0t0 TCP *:http (LISTEN) nginx 3251 nginx 10u IPv4 15355 0t0 TCP *:http (LISTEN)
查看nginx版本以及编译参数
[root@zxl-nginx ~]# /usr/local/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 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
5:访问nginx
[
root@zxl-nginx ~]# elinks http://127.0.0.1 --dump 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 [1]nginx.org. Commercial support is available at [2]nginx.com. Thank you for using nginx. References Visible links 1. http://nginx.org/ 2. http://nginx.com/
6:nginx总结问题
安装nginx过程会提示缺少相应的依赖包
yum install make gcc -y
安装nginx提示缺少pcre库问题
解决:yum install pcre-devel pcre -y
安装nginx提示openssl问题
解决:yum install openssl-devel openssl -y
启动nginx提示如下: /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory 解决: echo “/usr/local/lib” >> /etc/ld.so.conf ldconfig
本文出自 “流鼻涕” 博客,转载请与作者联系!
标签:nginx编译安装
原文地址:http://noodle.blog.51cto.com/2925423/1726411