CentOS 6.6 安装 nginx
2016-03-23 11:38
555 查看
Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,由俄罗斯的程序设计师Igor Sysoev所开发,其特点是占有内存少,并发能力强,第一个公开版本0.1.0发布于2004年10月4日,目前最新版本是2014年12月2日发布的1.7.8。
今天在ttlsa网站里学习了Nginx的安装方法,在虚拟机里测试过,然后又在服务器上安装了一遍,下面我把安装过程总结一下。
Linux系统:Centos 6.5 x64
Nginx版本:1.7.8
1、安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装。)
yum -y install pcre*
yum -y install openssl*
CentOS 6.5 我安装的时候是选择的“基本服务器”,默认这两个包都没安装全,所以这两个都运行安装即可。
2、下载nginx 1.7.8
wget http://nginx.org/download/nginx-1.7.8.tar.gz
3、解压编译安装
tar -zxvf nginx-1.7.8.tar.gz
然后进入目录编译安装
cd nginx-1.7.8
./configure --prefix=/usr/local/nginx-1.5.1
\
--with-http_ssl_module --with-http_spdy_module
\
--with-http_stub_status_module --with-pcre
如果没有error信息,就可以执行下边的安装了:
make
make install
4、开启nginx进程
/usr/local/nginx-1.7.8/sbin/nginx
重启或关闭进程:
/usr/local/nginx-1.7.8/sbin/nginx -s
reload
/usr/local/nginx-1.7.8/sbin/nginx -s
stop
5、关闭防火墙,或者添加防火墙规则就可以测试了。
service iptables stop
或者编辑配置文件:
vi /etc/sysconfig/iptables
添加这样一条开放80端口的规则后保存:
-A INPUT -m state --state
NEW -m tcp -p tcp --dport
80 -j ACCEPT
重启服务即可:
service iptables restart
ok,,可以浏览器访问了。
cache错误解决办法:
wget http://nginx.org/download/nginx-0.8.33.tar.gz
tar -zxvf nginx-0.8.33.tar.gz
cd nginx-0.8.33
./configure --prefix=/usr/local/nginx
安装Nginx时报错
./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
总结:
yum -y install pcre-devel openssl openssl-devel
./configure --prefix=/usr/local/nginx
make
make install
一切搞定
今天在ttlsa网站里学习了Nginx的安装方法,在虚拟机里测试过,然后又在服务器上安装了一遍,下面我把安装过程总结一下。
Linux系统:Centos 6.5 x64
Nginx版本:1.7.8
1、安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装。)
yum -y install pcre*
yum -y install openssl*
CentOS 6.5 我安装的时候是选择的“基本服务器”,默认这两个包都没安装全,所以这两个都运行安装即可。
2、下载nginx 1.7.8
wget http://nginx.org/download/nginx-1.7.8.tar.gz
3、解压编译安装
tar -zxvf nginx-1.7.8.tar.gz
然后进入目录编译安装
cd nginx-1.7.8
./configure --prefix=/usr/local/nginx-1.5.1
\
--with-http_ssl_module --with-http_spdy_module
\
--with-http_stub_status_module --with-pcre
如果没有error信息,就可以执行下边的安装了:
make
make install
4、开启nginx进程
/usr/local/nginx-1.7.8/sbin/nginx
重启或关闭进程:
/usr/local/nginx-1.7.8/sbin/nginx -s
reload
/usr/local/nginx-1.7.8/sbin/nginx -s
stop
5、关闭防火墙,或者添加防火墙规则就可以测试了。
service iptables stop
或者编辑配置文件:
vi /etc/sysconfig/iptables
添加这样一条开放80端口的规则后保存:
-A INPUT -m state --state
NEW -m tcp -p tcp --dport
80 -j ACCEPT
重启服务即可:
service iptables restart
ok,,可以浏览器访问了。
Welcome to nginx!
有时候,我们需要单独安装nginx,来处理大量的下载请求。单独在Centos5安装nginx遇到的rewrite和HTTPcache错误解决办法:
wget http://nginx.org/download/nginx-0.8.33.tar.gz
tar -zxvf nginx-0.8.33.tar.gz
cd nginx-0.8.33
./configure --prefix=/usr/local/nginx
安装Nginx时报错
./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
总结:
yum -y install pcre-devel openssl openssl-devel
./configure --prefix=/usr/local/nginx
make
make install
一切搞定
相关文章推荐
- nginx动静分离
- lvs+nginx负载均衡部署
- nginx 动、静分离 配置
- nginx缓存及压缩模块
- nginx负载均衡
- 启动 nginx 失败 "fastcgi_pass" directive is duplicate
- location讲解:
- nginx 别名配置
- nginx基于端口的虚拟主机:
- 自动化运维web环境搭建:Nginx+Django+uwsgi
- nginx虚拟主机包含配置方式(也可以一个虚拟主机配置一个单独的文件)
- 苹果电脑mac安装nginx教程
- nginx虚拟主机
- nginx.conf配置文件详解:
- 使用nginx哈希表
- php-fpm使用sock配置与nginx配置sock连接
- nginx配置
- nginx介绍
- nginx中的connnection
- 总结与备忘:nginx与php-fpm与php