1:操作系统环境如下
[[email protected] ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m [[email protected] ~]# uname -r 2.6.32-358.el6.x86_64 [[email protected] ~]#
2:nginx软件包版本
[[email protected] 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源码下载地址
[[email protected] src]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
3:安装nginx
[[email protected] 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 [[email protected] src]# tar fxz nginx-1.8.0.tar.gz [[email protected] src]# cd nginx-1.8.0 [[email protected] nginx-1.8.0]#./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module [[email protected] nginx-1.8.0]#make [[email protected] nginx-1.8.0]# make install
创建nginx 启动用户nginx
[[email protected] nginx-1.8.0]# useradd nginx -s /sbin/nologin -M
4:启动nginx
[[email protected] ~]# /usr/local/nginx/sbin/nginx [[email protected] ~]# 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版本以及编译参数
[[email protected] ~]# /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
[
[email protected] ~]# 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
时间: 2024-12-30 13:56:32