大佬教程收集整理的这篇文章主要介绍了阿里云CentOS6.5系统安装Nginx,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
一、以包的形式安装
安装说明
系统环境:CentOS-6.5
软件:Nginx-1.6.2.tar.gz
安装方式:源码编译安装
安装位置:/opt/program/Nginx-1.6.2
下载地址:http://Nginx.org/en/download.html
安装前提
在安装Nginx前,需要确保系统安装了g++、gcc、openssl-devel、pcre-devel和zlib-devel软件。安装必须软件:
# yum install gcc-c++ # yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel |
# find -name Nginx ./Nginx ./Nginx/sbin/Nginx ./Nginx-1.2.6/objs/Nginx |
检查系统安装的Nginx:
卸载原有的Nginx
# yum remove Nginx |
安装
将安装包文件上传到/opt/software中执行以下操作:
# cd /opt/program # mkdir Nginx # tar -zxvf ../software/Nginx-1.6.2.tar.gz # cdNginx-1.6.2 # ./configure --prefix=/opt/program/Nginx 注:处此是指定Nginx的安装目录,大多用户习惯于安装在/usr/local/Nginx下面 # make 编译 # make install 安装 |
配置 : 这步我没有执行,外部也可以访问
#修改防火墙配置: # vi + /etc/sysconfig/iptables #添加配置项 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #重启防火墙 # service iptables restart |
启动
#方法1 # /opt/program/Nginx/sbin/Nginx -c /opt/program/Nginx/sbin/Nginx/conf/Nginx.conf |
停止
#查询Nginx主进程号 ps -ef | grep Nginx |
重启
#/opt/program/Nginx/sbin/Nginx-s reload |
测试
#测试端口 netstat –na|grep 80 |
二、以yum的方式安装
一、直接通过yum安装 # yum list | grep Nginx # yum-yinstallNginx 二、下载rpm包安装 php,Nginx # rpm-ivhhttp://Nginx.org/packages/centos/6/noarch/RPMS/Nginx-release-centos-6-0.el6.ngx.noarch.rpm # yum-yinstallNginx # yum-yphp-fpm # chkconfigphp-fpmon 设置开机自动启动 # chkconfigNginxon 设置开机自动启动 # netstat -lntp | grep Nginx 查看端口 |
以上是大佬教程为你收集整理的阿里云CentOS6.5系统安装Nginx全部内容,希望文章能够帮你解决阿里云CentOS6.5系统安装Nginx所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。