CentOS 6.5安装配置Nginx
Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便。
但是今天装了CentOS6.5,直接yum install nginx不行,要先处理下源,下面是安装完整流程,也十分简单:
1、CentOS 6,先执行:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
2,查看yum的nginx信息
[]# yum info nginx
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.esocc.com
* extras: mirror.esocc.com
* updates: mirror.esocc.com
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:28
extras | 3.5 kB 00:00
extras/primary_db | 19 kB 00:00
nginx | 2.9 kB 00:00
nginx/primary_db | 22 kB 00:00
updates | 3.5 kB 00:00
updates/primary_db | 2.1 MB 00:10
Installed Packages
Name : nginx
Arch : x86_64
Version : 1.4.0
Release : 1.el6.ngx
Size : 874 k
Repo : installed
From repo : nginx
Summary : nginx is a high performance web server
URL : http://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
: a mail proxy server
3,安装并启动nignx
[root@server ~]# yun install nignx
[root@server ~]# service nginx start
Starting nginx: [ OK ]
4,然后进入浏览器,输入http://192.168.0.161/测试,如果看到
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. 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.
恭喜你,你成功了!
如果不能连接到nginx,原因很多,但是可以先检查 1,nginx服务是否真的起来了;2,linux服务器防火墙是否打开
配置
#修改防火墙配置: [root@admin nginx-1.2.6]# vi + /etc/sysconfig/iptables #添加配置项 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #重启防火墙 [root@admin nginx-1.2.6]# service iptables restart |
启动
#方法1 |
停止
#查询nginx主进程号 |
重启
[root@admin local]# /usr/local/nginx/sbin/nginx -s reload |
测试
#测试端口
netstat –na|grep 80
#浏览器中测试
http://ip:80
一般使用linux系统的不少网友可能都是直接使用一键安装包进行安装的,以前作者也这样,但是很多时候这些一键安装方便是方便但是可能在升级及其他很多地方不是很好,本文就说下在centos6.3安装nginx1.2的步骤。
安装说明
操作系统:centos6.3
软件:nginx-1.2.6.tar.gz
安装方式:源码编码安装
安装位置:/usr/local/nginx
nginx下载地址: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
检查系统安装的ningx
- find -name nginx
- ./nginx
- ./nginx/sbin/nginx
- ./nginx-1.2.6/objs/nginx
卸载系统原有的nginx
- yum remove nginx
centos安装nginx
将安装包文件上传到目录中,本文是上传到/usr/local中,按以下命令进行操作。
- [root@admin local]# cd /usr/local
- [root@admin local]# tar -zxv -f nginx-1.2.6.tar.gz
- [root@admin local]# rm -rf nginx-1.2.6.tar.gz
- [root@admin local]# mv nginx-1.2.6 nginx
- [root@admin local]# cd /usr/local/nginx
- [root@admin nginx]# ./configure --prefix=/usr/local/nginx
- [root@admin nginx]# make
- [root@admin nginx]# make install
配置防火墙
配置防火墙开启80端口,不开启的话,有时防火墙会不让外网访问80端口我们就无法访问nginx配置的网站了。
- #修改防火墙配置:
- [root@admin nginx-1.2.6]# vi + /etc/sysconfig/iptables
- #添加配置项
- -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
- #重启防火墙
- [root@admin nginx-1.2.6]# service iptables restart
启用nginx命令
- #方法1
- [root@admin nginx-1.2.6]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
- #方法2
- [root@admin nginx-1.2.6]# cd /usr/local/nginx/sbin
- [root@admin sbin]# ./nginx
停止nginx命令
- #查询nginx主进程号
- ps -ef | grep nginx
- #停止进程
- kill -QUIT 主进程号
- #快速停止
- kill -TERM 主进程号
- #强制停止
- pkill -9 nginx
重启nginx命令
- [root@admin local]# /usr/local/nginx/sbin/nginx -s reload
CentOS 6.5安装配置Nginx的更多相关文章
- CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL)
CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL) 一.准备篇: /etc/init.d/iptables stop #关闭防火墙 关闭SELINUX vi /etc/sel ...
- CentOS 7.0安装配置Vsftp服务器
一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...
- ELK 6安装配置 nginx日志收集 kabana汉化
#ELK 6安装配置 nginx日志收集 kabana汉化 #环境 centos 7.4 ,ELK 6 ,单节点 #服务端 Logstash 收集,过滤 Elasticsearch 存储,索引日志 K ...
- CentOS 7.0安装配置Vsftp服务器步骤详解
安装Vsftp讲过最多的就是在centos6.x版本中了,这里小编看到有朋友写了一篇非常不错的CentOS 7.0安装配置Vsftp服务器教程,下面整理分享给各位. 一.配置防火墙,开启FTP服务器需 ...
- centos tomcat/resin安装配置 卸载系统自带的java tomcat安装配置 安装JDK resin安装配置 第二十八节课
centos tomcat/resin安装配置 卸载系统自带的java tomcat安装配置 安装JDK resin安装配置 第二十八节课 tomcat和java都不需要编译 tom ...
- 【转发】【linux】【ftp】CentOS 7.0安装配置Vsftp服务器
adduser -d /var/www/android -g ftp -s /sbin/nologin ftp2 一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.0默认使用的是firew ...
- CentOS 7.2安装配置Vsftp服务器
一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.2默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...
- CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)
准备篇: CentOS 6.6系统安装配置图解教程 http://www.osyunwei.com/archives/8398.html 1.配置防火墙,开启80端口.3306端口 vi /etc/s ...
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
这篇文章主要介绍了CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)的方法,需要的朋友可以参考下 文章写的不错,很详细:IDO转载自网络: 准备篇: 1.配置防火墙,开启 ...
随机推荐
- hdu 3951 硬币围成一圈(博弈)
n个硬币围成一个环 每次只能取1-K个硬币 最后取完者胜 假如5个硬币 每次取1-2个情况1 先手取1个 后手取剩下4个中间2个 破坏了连续 虽然最后剩2个,但先手只能取一个 然后后再取一个 后手胜 ...
- 使用spring-boot-maven-plugin插件打包spring boot项目
在spring-boot项目中使用spring-boot-maven-plugin插件进行打包,输出可执行JAR包.项目包含多个模块,当打完包后在本地的maven仓库中发现输出的可执行JAR非常小,并 ...
- 【hihoCoder】#1513 : 小Hi的烦恼
题解 我会五维数点辣 只要用个bitset乱搞就好了 记录一下rk[i][j]表示第j科排名为i的是谁 用30000 * 5个大小为30000的bitset s[i][j]是一个bitset表示第j科 ...
- USACO 6.5 Closed Fences
Closed Fences A closed fence in the plane is a set of non-crossing, connected line segments with N c ...
- lr11录制时报“Request Connection: Remote Server @ 0.0.0.0:1080 (Service=?) NOT PROXIED! )”解决方法
在录制脚本的时候出现如下现象: 解决方法: LoadRunner录制脚本时出现:Unable to connect to remote server),有事件没有脚本的问题 1.首先要查看IE浏览 ...
- 微信公众号开发--用.Net Core实现微信消息加解密
1.进入微信公众号后台设置微信服务器配置参数(注意:Token和EncodingAESKey必须和微信服务器验证参数保持一致,不然验证不会通过). 2.设置为安全模式 3.代码实现(主要分为验证接口和 ...
- Android Studio奇技淫巧
No1: Ctrl+E:显示最近浏览过的文件 Ctrl+Shift+E:显示最近编辑过的文件 Ctrl+Tab:切换最近编辑过的文件 No2: 条件断点:断点右键 No3: 全局断点 这样只要碰到空指 ...
- windows下mysql配置(第一次)
忙活了大半天,总算配置好了,本文献给windows下没试用过Mysql的小白,勿喷 http://blog.csdn.net/z1074907546/article/details/51482718 ...
- 《JAVA软件结构与数据结构》第一周学习总结
学号 20172326 <JAVA软件结构与数据结构>第一周学习总结 教材学习内容总结 软件质量的几大特性 增长函数与大O记法 大O记法用来表示表示增长函数,从而来表示算法的复杂度 算法的 ...
- Ubuntu18.04 之jdk安装与环境配置
1.oracle官网下载压缩包. 下载地址为: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133 ...