CentOS6.4安装nginx1.4
首先下载nginx:
wget http://nginx.org/download/nginx-1.4.4.tar.gz
解压:
tar -zxvf nginx*
把Nginx移动到/usr/local/目录下:
mv nginx*.4 /usr/local/nginx
安装之前需要安装一些支持包:
yum -y install gcc-c++ zlib zlib-devel openssl openssl--devel pcre pcre-devel
然后进入Ngnix目录:
[root @test2 nginx]# ./configure --prefix=/usr/local/nginx
上述命令执行完后执行:
make
这是出现了一点问题:Centos提示-bash: make: command not found
make没有安装;因为是新装的系统,所以很多没有配置。解决这个问题很简单,安装一个make就可以了
yum -y install gcc automake autoconf libtool make
到这一步,如果没有报错就执行:
make install
出现问题了:
cp: "conf/koi-win" 与"/usr/local/nginx/conf/koi-win" 为同一文件
make[1]: *** [install] 错误 1
make[1]: Leaving directory `/usr/local/nginx'
make: *** [install] 错误 2
文件名重复在“./configure” 的时候出现了问题;
先删除那个文件,重来一次:
[root@test2 nginx]# pwd
/home/sec/soft/nginx
[root@test2 nginx]# ls
auto CHANGES.ru configure html man src
CHANGES conf contrib LICENSE README
当前工作目录:
执行:
[root@test2 nginx]# ./configure --prefix=/usr/local/nginx
然后
make&&make install
到这里还需要配置防火墙:因为80端口centOS是默认关闭的:
[root@test2 ~]# cd /etc/sysconfig
[root@test2 sysconfig]# pwd
/etc/sysconfig
[root@test2 sysconfig]# vi iptables# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
添加一条80端口,然后重启防火墙即可:
[root@test2 sysconfig]# service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
到现在为止我还需要做一点懒人的事情:
[root@test2 sysconfig]# vi /etc/init.d/nginx
把下面这段脚本添加进去:
#chkconfig: - 85 15
# description: Nginx is a World Wide Web server.
# processname: nginxnginx=/usr/local/nginx/sbin/nginx
conf=/usr/local/nginx/conf/nginx.confcase $1 instart)echo -n "Starting Nginx"$nginx -c $confecho " done";;stop)echo -n "Stopping Nginx"killall -9 nginxecho " done";;test)$nginx -t -c $conf;;reload)echo -n "Reloading Nginx"ps auxww | grep nginx | grep master | awk '{print $2}' | xargs kill -HUPecho " done";;restart)$cription: Nginx is a World Wide Web server.
# processname: nginxnginx=/usr/local/nginx/sbin/nginx
conf=/usr/local/nginx/conf/nginx.conf
case $1 instart)echo -n "Starting Nginx"$nginx -c $confecho " done";;stop)$0 start;;show)ps -aux|grep nginx;;*)echo -n "Usage: $0 {start|restart|reload|stop|test|show}";;esac
然后保存!
再给这个文件添加可执行的权限:
chmod +x nginx
如果你的和我之前一样那么有下面的效果:
[root@test2 init.d]# ./nginx restart
Stopping Nginx done
Starting Nginx done
然后把它添加到系统服务并且设置开机启动:
[root@test2 init.d]# chkconfig --add nginx
[root@test2 init.d]# chkconfig nginx on
[root@test2 init.d]# service nginx restart
Stopping Nginx done
Starting Nginx done
然后你就可以使用你的服务器IP在另外的一台服务器上面可以访问了
转载于:https://my.oschina.net/websec/blog/178133
CentOS6.4安装nginx1.4相关推荐
- CentOS6.5安装nginx1.5.8时出现“cp: conf/koi-win 与/usr/local/nginx/conf/koi-win 为同一文件”的解决方法...
安装方法主要参考了:http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html这篇文章,出现"cp: "conf/k ...
- CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28
2019独角兽企业重金招聘Python工程师标准>>> [准备工作] 01 #在编译安装lnmp之前,首先先卸载已存在的rpm包. 02 rpm -e httpd 03 rpm -e ...
- Linux(CentOS6.5)下编译安装Nginx1.10.1
原文出自:http://www.cnblogs.com/comexchan/p/5815753.html Linux(CentOS6.5)下编译安装Nginx1.10.1 首先在特权账号(root)下 ...
- centos6.8 安装nginx
centos6.8 安装nginx需要编译nginx源码,不过没啥大不了的,按照步骤来,肯定能成功. 1.安装必要的依赖: yum install -y gcc-c++yum install -y p ...
- 编译安装nginx-1.6.0
一.环境 系统:CentOS6.4x64最小化安装 IP: 192.168.3.48 二.安装基础软件 [root@lnmp-test ~]# yum install make gcc gcc- ...
- 2020.9.16工作问题记录————CentOS6离线安装nginx和keepalived
工作问题记录----CentOS6离线安装nginx和keepalived 1.下载 nginx 和 keepalived 安装包并传入虚拟机: nginx 下载地址:http://nginx.org ...
- centos6一键安装vsftpd脚本
centos6一键安装vsftpd脚本 手动安装vsftpd参考教程:Centos下安装Vsftpd的图文教程 vsftpd脚本功能: 1.安装 (命令执行:sh xxx.sh)2.添加ftp用户 ( ...
- linux卸载hadoop版本,centos6.5 安装hadoop1.2.1的教程详解【亲测版】
本篇只简单介绍安装步骤 1. 角色分配 10.11.84.4 web-crawler--1.novalocal master/slave 10.11.84.5 web-crawler--2.noval ...
- mysql+1.6安装,CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法
这篇文章主要介绍了CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享,需要的朋友可以参考下准备篇: 一.配置防火墙,开启80端口.3306端口 Cen ...
最新文章
- python 推迟运行_一文看懂Python的time模块sleep()方法和strftime()方法
- [转] Android系统版本号和Android API level对应表
- 【IOC 控制反转】Android 事件依赖注入 ( 事件依赖注入具体的操作细节 | 创建 事件监听器 对应的 动态代理 | 动态代理的数据准备 | 创建调用处理程序 | 创建动态代理实例对象 )
- 如何让word档在同一页上显示两列或更多列
- Silverlight实用窍门系列:51.Silverlight页面控件的放大缩小、Silverlight和Html控件的互相操作...
- 对网络数据包进行嗅探
- 猎豹浏览器怎么设置允许弹出窗口 允许弹窗设置方法详解
- 系统架构师学习笔记-信息系统基础知识
- Sql Server中的几个系统表(二)
- i9可以装服务器系统吗,i9服务器
- 前端埋点的缺点_【埋点学习埋点质量】埋点的框架设计及其准确性
- python换零钱有多少种方案_Python之100个项目:零钱转换程序
- 低照度图像修复方法总结
- IntelliJ IDEA for CleanCode
- 结构体的成员偏移地址和字节对齐
- linux img提取文件系统,镜像文件提取System.img解/打包工具及常用命令
- 北京交通大学离散数学 谓词逻辑_离散数学测验题——谓词逻辑答案
- 国内外银行核心系统之间的差异
- 两数求和(C语言超简单解法)
- 产品经理学习笔记(13)-用户反馈的意义