centos6.5 安装nginx1.10

系统环境 centos6.5 x64 mini

关闭防火墙

关闭selinux

开始安装nginx

创建用户

[[email protected] sbin]# useradd -M nginx -s /sbin/nologin

安装环境需要的包

yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

wget  http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz

wget  https://www.openssl.org/source/openssl-1.0.2h.tar.gz

wget  http://zlib.net/zlib-1.2.8.tar.gz

wget  http://nginx.org/download/nginx-1.10.0.tar.gz

这里下载的包,解压的位置和下面配置参数路径要一致。

解压安装nginx包

tar -zxvf nginx-1.10.0.tar.gz

cd nginx-1.10.0

配置

./configure \

–prefix=/usr/local/nginx \

–lock-path=/usr/local/nginx/nginx.lock \

–user=nginx \

–group=nginx \

–http-client-body-temp-path=/usr/local/nginx/client/ \

–http-proxy-temp-path=/usr/local/nginx/proxy/ \

–http-fastcgi-temp-path=/usr/local/nginx/fcgi/ \

–http-uwsgi-temp-path=/usr/local/nginx/uwsgi \

–http-scgi-temp-path=/usr/local/nginx/scgi \

–with-http_ssl_module \

–with-http_flv_module \

–with-http_mp4_module \

–with-http_gunzip_module \

–with-http_ssl_module \

–with-http_flv_module \

–with-http_stub_status_module \

–with-http_gzip_static_module \

–with-file-aio \

–with-http_image_filter_module \

–with-http_realip_module \

–with-pcre=/tar/pcre-8.38 \

–with-stream \

–with-openssl=/tar/openssl-1.0.2h \

–with-zlib=/tar/zlib-1.2.8

编译 && 编译安装

make && make install

启动nginx

/usr/local/nginx/sbin/nginx

创建启动停止脚本

vim /etc/init.d/nginx

#!/bin/sh

#

# nginx – this script starts and stops the nginx daemin

#

# chkconfig:   – 85 15

# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \

#               proxy and IMAP/POP3 proxy server

# processname: nginx

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ “$NETWORKING” = “no” ] && exit 0

nginx=”/usr/local/nginx/sbin/nginx”

prog=$(basename $nginx)

NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf”

lockfile=/usr/local/nginx/nginx.lock

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

echo -n $”Starting $prog: “

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $”Stopping $prog: “

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

}

restart() {

configtest || return $?

stop

start

}

reload() {

configtest || return $?

echo -n $”Reloading $prog: “

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case “$1” in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $”Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}”

exit 2

esac

查看器启动状态

netstat -anpt  |grep 80

tcp    0      0 0.0.0.0:80         0.0.0.0:*        LISTEN      6217/nginx

访问测试

http://ip地址

时间: 2024-10-12 20:30:30

centos6.5 安装nginx1.10的相关文章

CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4 5.5 5.6 7.0 7.1多版本全能环境

准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑

CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11

这篇文章主要介绍了CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11,需要的朋友可以参考下准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动 2.安装ipta

CentOS6.8编译安装Nginx1.10.2+MySQL5.7.16+PHP7.0.12

1.    下载 #MySQL下载地址 http://dev.mysql.com/downloads/mysql/ #Nginx下载地址 http://nginx.org/en/download.html #PHP下载地址 http://php.net/downloads.php 使用WinSCP把下载好的压缩包上传到/usr/local/src目录 mysql-5.7.16.tar.gz nginx-1.10.2.tar.gz php-7.0.12.tar.gz 2.    安装 2.1   

Centos6.7安装nginx-1.11.10

yum grouplist #查看已经安装的组 Installed Groups:  #已经安装的组 Available Groups:    #可以安装的组 同步系统时间 编译安装nginx 安装#yum -y groupinstall "Development Tools" "Server Platform Libraries" #tar xf nginx-1.10.2.tar.gz #cd nginx-1.10.2 #groupadd -r -g 108 ng

Linux(CentOS6.5)下编译安装Nginx1.10.1

首先在特权账号(root)下安装编译时依赖项: yum install gcc gcc-c++ perl -y 首先以非特权账号(本文以账号comex为例)登陆OS: 进入data目录下载相关安装介质 mkdir /comexData/package cd /comexData/package wget http://nginx.org/download/nginx-1.10.1.tar.gz wget http://120.52.73.43/jaist.dl.sourceforge.net/p

在ubuntu16编译安装nginx-1.10.2(full)完全自带组件

第一步:先安装全部用到的包 apt install gcc libpcre++-dev libssl-dev make libxml2-dev libxslt-dev libgd-dev libgeoip-dev libgoogle-perftools-dev libatomic-ops-dev libperl-dev 第二步:下载并解压nginx-1.10.2.tar.gz wget http://nginx.org/download/nginx-1.10.2.tar.gz tar zxvf

CentOS7.2 安装nginx-1.10.3

nginx-1.10.3 下载nginx 检查是否安装了依赖库: [[email protected] ~]# rpm -q gcc gcc-4.8.5-11.el7.x86_64 [[email protected] ~]# rpm -q openssl openssl-1.0.1e-60.el7_3.1.x86_64 [[email protected] ~]# rpm -q zlib zlib-1.2.7-17.el7.x86_64 [[email protected] ~]# rpm -

搭建LNAMP环境(二)- 源码安装Nginx1.10

上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel 软件包说明:zlib: 为nginx提供gzip模块,需要zlib库支持pcre: 为支持地址重写rewrite功能openssl:为nginx提供ssl功能 2.创建nginx用户组和用户 groupadd nginx useradd -r -g nginx

5分钟编译安装nginx1.10.1支持清除缓存

实现功能: nginx稳定版本 支持模块purge.rewrite.ssl等等 软件包下载 等等等等.... 本文送给需要安装nginx的小伙伴,由于本人编代码能力非常有限,故下面的脚本写的很烂,勿喷. 相信下面的脚本是个人都能看懂!!! cat nginx.sh yum -y install wget git vim make gcc gcc-c++ openssl-devel #安装依赖库 mkdir /root/appcd /root/appmkdir -p /usr/local/ngin