linux下nginx安装方法

因为本人不是很懂linux,所以安装步骤是从网上找的一些资料整合后,才部署成功,现将步骤记录下来

部署安装nainx环境:pcre(作用rewrite)、zlib(作用压缩)、ssl、gcc
yum -y install zlib;
yum –y install pcre;
yum –y install openssl;
yum install gcc gcc-c++ ncurses-devel perl;

2、下载安装nginx-*.tar.gz。     (*号表示版本号

tar –zxvf nginx-*.tar.gz –C ./;     #解压
cd nginx-*;                 #进入目录
./congigure --prefix=/usr/local/nginx;   #配置安装位置 也可不加此参数
make;                       
make install;               #安装  就是将你的解压目录复制到配置文件的指定地点,看执行过程能看出,大部分linux命令执行的是 cp

3、安装完成后执行以下操作验证安装是否成功:

#如果你的安装路径不是这个,那么进入到自己的安装目录下 执行第二条命令
cd  /usr/local/nginx/sbin  
./nginx -t   

结果显示:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
至此,nginx的安装已成功完成。


如果在操作第二步时报错,请按以下方法解决:
1.错误提示:./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题:
yum -y install pcre-devel

2.错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
解决办法:
yum -y install openssl openssl-devel

大部分出现问题,都是缺少依赖包导致,如果还有其他的问题,请安装相对应的依赖包;

posted on 2016-01-07 11:27  冰封♀啸  阅读(107)  评论(0编辑  收藏  举报

导航