centos7 64位使用心得
系统:Centos7 64位Nginx: http://nginx.org/en/download.html我下载1.10.3http://img.blog.csdn.net/20150821150010442?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center下载模块依赖性Nginx需要依赖下面3个包1.gzip 模块需要 zlib 库 ( 下载: http://www.zlib.NET/ )2.rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )3.ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )
依赖包安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包http://img.blog.csdn.net/20150821150141642?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Centerhttp://img.blog.csdn.net/20150821150151849?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Centerhttp://img.blog.csdn.net/20150821150200105?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center如果没有安装c++编译环境,还得安装,通过yum install gcc-c++完成安装
下载完成后:http://img.blog.csdn.net/20150821150258664?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center
下一步,编译安装openssl :
tar zxvf openssl-fips-2.0.9.tar.gz cd openssl-fips-2.0.9 ./config && make && make install
pcre:
tar zxvf pcre-8.36.tar.gz cd pcre-8.36./configure && make && make install
zlib:tar zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8./configure && make && make install
最后安装nginxtar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0./configure && make && make installhttp://img.blog.csdn.net/20150821150416885?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center
安装完成后,可启动nginx:http://img.blog.csdn.net/20150821150450044?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center启动命令:/usr/local/nginx/sbin/nginx
发现报错了:
error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
经网上查询,这是Linux的通病
# sbin/nginx
sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
# whereis libpcre.so.1
libpcre.so: /lib64/libpcre.so.0 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.1
# ln -s /usr/local/lib/libpcre.so.1 /lib64
# sbin/nginx
先找到libpcre.so.1所在位置,然后做个软链接就可以了。
查看是否已启动:http://img.blog.csdn.net/20150821150552038?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center
通过浏览器访问:http://img.blog.csdn.net/20150821150615674?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center
看到这个就说明nginx安装并启动成功。
ps:启动:/usr/local/nginx/sbin/nginx
停止/重新加载:/usr/local/nginx/sbin/nginx -s stop(quit、reload)
验证配置文件是否合法:/usr/local/nginx/sbin/nginx -t
命令帮助:/usr/local/nginx/sbin/nginx -h
如果中途安装失败,就把 liblib64 nginx 目录下所有文件删除重新安装
:victory:
页:
[1]