centos 6.5安装快速安装部署nginx-1.9.4

1、首先用yum安装nginx需要的的插件。

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

yum -y install gcc gcc-c++ autoconf automake

yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

【注释】不要问我为什么安装这些,因为我在后面执行./configure时报错提示缺少这些组件。主要和我需要安装那些模块和功能支持有关系。

2、下载nginx-1.9.4安装包,可以到官网上面下载。

解压,新建nginx用户组和nginx用户,并设置为不可登陆。

tar -zxvf nginx-1.9.4.tar.gz

cd nginx-1.9.4

groupadd -r nginx

useradd -s /sbin/nologin -g nginx -r nginx

3、执行./configure检查环境

./configure --prefix=/opt/nginx --sbin-path=/usr/sbin/nginx --conf-path=/opt/nginx/nginx.conf --error-log-path=/opt/nginx/logs/error.log --http-log-path=/opt/nginx/logs/access.log --pid-path=/opt/nginx/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt=‘-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic‘

【注释】以上参数主要是指定 nginx的安装目录,启动命令路径,配置文件路径,错误日志路径,和你需要的安装的模块,具体的在官网和网上都有说明,这里就不一一介绍。

4、执行编译安装

make && make install

5、

cd nginx

mv nginx.conf nginx.conf.bak       #备份初始配置文件

[[email protected] ~]# cat /opt/nginx/nginx.conf  #上传我自己的配置好的conf文件

#user  nobody;

worker_processes 1;

error_log logs/error.log;

pid  /opt/nginx/nginx.pid;

worker_rlimit_nofile 65535;

events {

use epoll;

worker_connections 65535;

}

http {

include mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

sendfile on;

tcp_nopush on;

keepalive_timeout  65;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

gzip  on;

gzip_min_length  1k;

gzip_buffers     4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types       text/plain application/x-javascript text/css application/xml;

gzip_vary on;

client_max_body_size 300m;

client_body_buffer_size 128k;

proxy_connect_timeout  600;

proxy_read_timeout   600;

proxy_send_timeout 600;

proxy_buffer_size 16k;

proxy_buffers 4 32k;

proxy_busy_buffers_size 54k;

proxy_temp_file_write_size 64k;

upstream hm.bioeh.com {

server 192.168.2.11:8080 weight=10 max_fails=2 fail_timeout=30s;

server 192.168.2.12:8080 weight=10 max_fails=2 fail_timeout=30s;

}

upstream doctor_server_pool {

server 192.168.2.11:8081 weight=10 max_fails=2 fail_timeout=30s;

server 192.168.2.12:8081 weight=10 max_fails=2 fail_timeout=30s;

}

server {

listen       80;

server_name  hm.bioeh.com;

charset utf-8;

location /bsp/ {

root   html;

index  index.html index.htm;

proxy_pass     http://hm.bioeh.com;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header x-forwarded-for $remote_addr;

client_max_body_size 100m;

}

location /doctor/ {

root   html;

index  index.html index.htm;

proxy_pass     http://doctor_server_pool;

proxy_set_header X-Real-IP $remote_addr;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 100m;

}

}

}

nginx -c nginx.conf             #检查配置文件

mkdir -p /var/cache/nginx/client_temp #提示有错误,需要创建这个目录

nginx -c nginx.conf             #再次检查配置文件,没有问题

6、启动nginx

#nginx

# netstat -tulnp|grep 80

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

【注释】80端口存在,说明服务启动成功,也telnet IP 80查看,或者直接在浏览器访问。

时间: 2024-08-11 05:35:04

centos 6.5安装快速安装部署nginx-1.9.4的相关文章

centos 6.5 x64bit 快速安装openstack

OpenStack是一个美国国家航空航天局和Rackspace合作研发的,以Apache许可证授权,并且是一个自由软件和开放源代码项目. OpenStack是一个云平台管理的项目,它不是一个软件.这个项目由几个主要的组件组合起来完成一些具体的工作. OpenStack是一个旨在为公共及私有云的建设与管理提供软件的开源项目.它的社区拥有超过130家企业及1350位开发者,这些机构与个人都将OpenStack作为基础设施即服务(简称IaaS)资源的通用前端. OpenStack项目的首要任务是简化云

CentOS 7 X64 LNMP快速安装

1. 背景 一台云服务器  CentOS 7.X x64 最快速的安装,展示类应用 2. 安装过程 # 更新epel-release 依赖库 yum install epel-release -y # 强制YUM安装Nginx.Mariadb.PHP组件 yum -y install nginx* mariadb* php* --skip-broken # 启动服务并设置开机启动服务 systemctl start nginx systemctl start mysqld systemctl e

CentOS下使用yum快速安装memcached

参考文章: 1. http://www.free521.com/tutorials/vps-tutorials/4360.html 2. http://snowolf.iteye.com/blog/1447348 3. memcache 连接错误  http://chenwei.me/p/70.html ------------------------------------------------------------------------------------------ 1. 查找M

Centos7 下面安装docker 部署Nginx

实验 环境 Centos 7 操作系统 安装docker yum install docker -y 查看docker 是否安装成功 docker -v Docker version 1.12.6, build 3a094bd/1.12.6 启动docker systemctl start docker 部署Nginx 获取基础镜像 docker pull nginx:1.10.3 查看 镜像 1.直接启动容器 docker run -d -p 8080:80 nginx:1.10.3 解释:

CentOS RDO方式快速安装OpenStack

一.了解RDO RDO是什么? RDO是红帽Red Hat Enterprise Linux OpenStack Platform的社区版,类似RHEL和Fedora,RHEV和oVirt这样的关系. 说白了,就是红帽支持一个开源项目,让你帮他踩坑,得到成熟稳定的版本,红帽搞一个企业版赚钱. 这个就是红帽的商业模式,其实是多方受益的,用户有一个开源免费的软件工具使用,当然前期可能“坑”比较多,但是和红帽一起磨合,共同提高稳定性,比较典型的就是CentOS.红帽发行商业版,赚去服务费,对可靠性.稳

Centos 7 使用shell 实现redis快速安装

使用shell 编写快速安装Redis服务 #!/bin/bash yum install cpp binutils glibc-kernheaders glibc-common glibc-devel gcc make wget #安装依赖库 wget http://download.redis.io/releases/redis-4.0.1.tar.gz if [ -f /root/redis-4.0.1.tar.gz ];then tar zxvf redis-4.0.1.tar.gz m

如何在CentOS 6上通过YUM安装Nginx和PHP-FPM(转)

准备篇: 1.配置防火墙,开启80端口.3306端口       vi /etc/sysconfig/iptables       -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙)       -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT(允许3306端口通过防火墙)特别提示:很多网友把这两条规则添加到防

centos 快速安装memcached

1.由于CentOS系统默认源没有memcache安装包,因此需要导入第三方的源.执行如下两条命令: [[email protected] data]# wget ftp://fr2.rpmfind.net/linux/epel/5/ppc/epel-release-5-4.noarch.rpm [[email protected] data]# rpm -ivh epel-release-5-4.noarch.rpm 2.yum安装Memcache服务器与php扩展 [[email prote

Centos 7.0 编译安装LNMP(Linxu+nginx+mysql+php)之源码安装nginx (一)

nginx简介:       Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日. 其将源代码以类BSD许可证的形式发布,因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名.2011年6月1日,nginx 1.0.4发布. Nginx是一款轻量级的Web 服务器