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

linux 安装nginx

2016-07-27 22:33 686 查看
一、

wget http://nginx.org/download/nginx-1.5.9.tar.gz直接在Linux上用命令下载[/code] 
二、

解压 tar -zxvf nginx-1.5.9.tar.gz


三、

设置一下配置信息 ./configure --prefix=/usr/local/nginx


四、

make 编译


五、

make install 安装


在配置信息的时候,也就是在第三步,出现了一下错误:

错误为:./configure: error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题
yum -y install pcre-devel


错误提示:./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


./nginx -v 先打开/usr/local/nginx/sbin 再执行命令

安装成功后,只能本地访问,还需要设置防火墙

vim /etc/sysconfig/iptables 编辑防火墙文件
新增
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT   //--防火墙不拦截80端口
保存退出 :wq
service iptables restart   重启防火墙


卸载方式:

直接删除安装目录

//启动
./nginx

//关闭
pkill  nginx


还有些其他方式关闭启动,网上搜就可以
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: