您的位置:首页 > 运维架构 > Nginx

Linux安装Nginx手册

2018-02-26 14:25 381 查看
将压缩文件都拷贝到/usr/local目录下面:
1、安装zlib-1.2.11.tar.gz

解压:tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11

./configuremake   make install  2、安装pcre-8.40.tar.gz  解压:tar –zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure 
make
make install
3、安装openssl-1.0.1s.tar.gz
tar -zxf openssl-1.0.1s.tar.gz

cd openssl-1.0.1s
./config
make
make test
make install
4、安装nginx-1.11.13.tar.gz
cd nginx-1.11.13
./configure --sbin-path=/usr/local/nginx/sbin/nginx  --conf-path=/usr/local/nginx/conf/nginx.conf --pid-path=/usr/local/nginx/sbin/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11  
或者
./configure --sbin-path=/usr/local/nginx/sbin/nginx  --conf-path=/usr/local/nginx/conf/nginx.conf--pid-path=/usr/local/nginx/sbin/nginx.pid --with-http_ssl_module --with-stream--with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11  --with-openssl=/usr/local/sslmake  
make install 
测试nginx.conf的配置是否正确: /usr/local/nginx/sbin/nginx -t
根据nginx.conf里的配置,启动nginx服务 : /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
出现错误:错误1:checking for OS
 + Linux 2.6.32-431.el6.x86_64 x86_64
checking for Ccompiler ... not found
./configure:error: C compiler cc is not found
执行脚本:yum install gcc-c++
yum cleanall
yum makecache
错误2:./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSLlibrary
into the system, or build the OpenSSL library statically from thesource
with nginx by using --with-openssl=<path> option.
获取路径which openssl
添加--with-openssl=/usr/bin/openssl
错误3:[/usr/local/openssl//.openssl/include/openssl/ssl.h]Error 127解决方案:
打开nginx源文件下的/usr/local/src/nginx-1.11.13/auto/lib/openssl/conf文件:
找到这么一段代码:
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
修改成以下代码:
CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Nginx Linux