设为首页 收藏本站
查看: 1306|回复: 0

[经验分享] CentOS6.5编译安装Nginx和Openssl

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-3-5 14:24:09 | 显示全部楼层 |阅读模式
  Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上nginx的小文件并发能力在同类型的网页服务器中表现较好。
Nginx的编译安装:
1.下载Openssl
1
[iyunv@Node1 ~]# wget http://www.openssl.org/source/openssl-1.0.2.tar.gz




2.下载nginx
1
[iyunv@Node1 ~]# wget http://nginx.org/download/nginx-1.6.2.tar.gz




3.解压软件
1
2
[iyunv@Node1 ~]# tar zxf openssl-1.0.2.tar.gz
[iyunv@Node1 ~]# tar zxf nginx-1.6.2.tar.gz




4.编译Nginx
1
2
[iyunv@Node1 ~]# cd nginx-1.6.2
[iyunv@Node1 nginx-1.6.2]# ./configure  --user=www --group=www --prefix=/data/nginx1.6.2 --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-openssl=/root/openssl-1.0.2



注意:编译nginx添加ssl支持,如果需要编译的openssl,是不需要编译opensll,--with-openssl=DIR DIR是openssl的源码路径,不是openssl的安装路径,否则make时将出错:

1
2
3
4
5
6
7
8
9
10
11
12
make[1]: Entering directory `/root/nginx-1.6.2'
cd /server/openssl
        && make clean
        && ./config --prefix=/server/openssl/openssl no-shared  no-threads
        && make
        && make install
make[2]: Entering directory `/server/openssl'
make[2]: *** No rule to make target `clean'.  Stop.
make[2]: Leaving directory `/server/openssl'
make[1]: *** [/server/openssl/openssl/include/openssl/ssl.h] Error 2
make[1]: Leaving directory `/root/nginx-0.7.61'
make: *** [build] Error 2




如果出现
1
2
3
4
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre= option.



这说明没有安装pcre &  pcre-devel包,这里yum安装
1
[iyunv@Node1 nginx-1.6.2]# yum -y install pcre pcre-devel




5.安装Nginx
1
2
3
[iyunv@Node1 nginx-1.6.2]# make

[iyunv@Node1 nginx-1.6.2]# make install




6.启动之前检查nginx
1
2
3
4
[iyunv@Node1 nginx-1.6.2]# /data/nginx1.6.2/sbin/nginx -t
nginx: the configuration file /data/nginx1.6.2/conf/nginx.conf syntax is ok
nginx: [emerg] getpwnam("www") failed
nginx: configuration file /data/nginx1.6.2/conf/nginx.conf test failed



检查发现是没有运行用户,新增www账户
1
2
[iyunv@Node1 nginx-1.6.2]# groupadd www
[iyunv@Node1 nginx-1.6.2]# useradd -g www -s /sbin/nologin -d /dev/null www



7.再次检查
[iyunv@Node1 nginx-1.6.2]# /data/nginx1.6.2/sbin/nginx -t
nginx: the configuration file /data/nginx1.6.2/conf/nginx.conf syntax is ok
nginx: configuration file /data/nginx1.6.2/conf/nginx.conf test is successful


8.启动Nginx
1
[iyunv@Node1 nginx-1.6.2]# /data/nginx1.6.2/sbin/nginx



9.检查端口
1
2
[iyunv@Node1 nginx-1.6.2]# netstat -ntlup |grep :80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      19849/nginx



10.检查进程
1
2
3
4
[iyunv@Node1 nginx-1.6.2]# ps aux |grep nginx
root     19849  0.0  0.0  22664   852 ?        Ss   11:19   0:00 nginx: master process /data/nginx1.6.2/sbin/nginx
www      19850  0.0  0.1  23100  1448 ?        S    11:19   0:00 nginx: worker process
root     19858  0.0  0.0 103244   856 pts/0    S+   11:21   0:00 grep nginx



11.网站访问
wKioL1T2fL_zYxrrAAGEdK_4bkY849.jpg


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-43709-1-1.html 上篇帖子: nginx慢查询 下篇帖子: Nginx服务器和PHP服务器分布式部署 代理服务器 搜索引擎 俄罗斯 设计师 程序
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表