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

[经验分享] Nginx安装过程

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-12-7 08:39:46 | 显示全部楼层 |阅读模式
linux版本系统

[iyunv@amigo ~]# cat /etc/redhat-release

CentOS release 6.6 (Final)

[iyunv@amigo ~]# uname -r

2.6.32-504.el6.x86_64



需要先关闭linux防火墙和selinux

关闭linux防火墙

[iyunv@amigo nginx-1.6.3]# chkconfig iptables off

[iyunv@amigo nginx-1.6.3]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [ OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]



关闭selinx

[iyunv@amigo etc]# vim /etc/selinux/config   

SELINUX=disabled



安装nginx依赖

[iyunv@amigo ~]# yum install pcre pcre-devel  openssl openssl-devel

Loaded plugins: fastestmirror, security

Setting up Install Process

Loading mirror speeds from cached hostfile

*base: mirrors.btte.net

*extras: mirrors.nwsuaf.edu.cn

*updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package openssl.x86_640:1.0.1e-30.el6 will be updated

---> Package openssl.x86_640:1.0.1e-48.el6_8.3 will be an update

---> Package openssl-devel.x86_640:1.0.1e-48.el6_8.3 will be installed

--> Processing Dependency: zlib-develfor package: openssl-devel-1.0.1e-48.el6_8.3.x86_64

--> Processing Dependency: krb5-develfor package: openssl-devel-1.0.1e-48.el6_8.3.x86_64

---> Package pcre.x86_64 0:7.8-6.el6will be updated

---> Package pcre.x86_64 0:7.8-7.el6will be an update

---> Package pcre-devel.x86_640:7.8-7.el6 will be installed

此过程省略。。



查看依赖安装版本及是否成功

[iyunv@amigo ~]# rpm -qa pcre pcre-devel openssl openssl-devel

pcre-7.8-7.el6.x86_64

openssl-devel-1.0.1e-48.el6_8.3.x86_64

openssl-1.0.1e-48.el6_8.3.x86_64

pcre-devel-7.8-7.el6.x86_64



创建tools文件夹存放nginx下载包

[iyunv@amigo ~]# mkdir -p /home/oldboy/tools



下载nginx版本

[iyunv@amigo tools]# wget -qhttp://nginx.org/download/nginx-1.6.3.tar.gz

[iyunv@amigo tools]# ls

nginx-1.6.3.tar.gz



创建傀儡用户

[iyunv@amigo tools]# useradd nginx -s /sbin/nologin  -M

解压nginx安装包

[iyunv@amigo tools]# tar xf nginx-1.6.3.tar.gz



进入nginx目录并执行编译

[iyunv@amigo tools]# cd nginx-1.6.3

[iyunv@amigo nginx-1.6.3]# ./configure --user=nginx --group=nginx--prefix=/aplication/nginx-1.6.3/ --with-http_stub_status_module--with-http_ssl_module



checking for OS

+Linux 2.6.32-504.el6.x86_64 x86_64

checking for C compiler ... found

+using GNU C compiler

+gcc version: 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

checking for gcc -pipe switch ... found

checking for gcc builtin atomic operations... found

checking for C99 variadic macros ... found

checking for gcc variadic macros ... found

checking for unistd.h ... found

checking for inttypes.h ... found

checking for limits.h ... found

checking for sys/filio.h ... not found

checking for sys/param.h ... found

checking for sys/mount.h ... found

checking for sys/statvfs.h ... found

checking for crypt.h ... found

此过程省略。。

make

make install



创建软链接文件

[iyunv@amigo nginx-1.6.3]# ln -s /aplication/nginx-1.6.3//aplication/nginx



启动并检查nginx配置文件

[iyunv@amigo nginx-1.6.3]# /aplication/nginx/sbin/nginx -t

nginx: the configuration file/aplication/nginx-1.6.3//conf/nginx.conf syntax is ok

nginx: configuration file /aplication/nginx-1.6.3//conf/nginx.conftest is successful



启动nginx

[iyunv@amigo nginx-1.6.3]# /aplication/nginx/sbin/nginx



查看nginx服务端口是否启动

[iyunv@amigo nginx-1.6.3]# lsof -i :80

COMMAND  PID  USER  FD   TYPE DEVICE SIZE/OFF NODENAME

nginx   7538  root   6u  IPv4  50782     0t0  TCP *:http (LISTEN)

nginx   7539 nginx    6u IPv4  50782      0t0 TCP *:http (LISTEN)



浏览器输入nginx地址

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.



运维网声明 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-310715-1-1.html 上篇帖子: nginx keepalived 配置 下篇帖子: Nginx HttpMemcModule和直接访问memcached效率对比测试
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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