您的位置:首页 > 运维架构 > 网站架构

Exchange 2013 高可用架构

2015-02-13 15:33 197 查看
一、安装nginx非常简单,本篇主要说下nginx的特点,以及我对大牛张宴的膜拜。

二、nginx的特点
nginx静态文件处理非常好;反向代理非常好;FastCGI好;web缓存好;稳定性非常好;安全性一般等特点

我喜欢nginx的原因是内存和cpu占用率低(1个nginx进程消耗15M内存),可以高并发连接

nginx能不能取代apache我不知道,它和apache各有千秋

nginx的模块有很多,这里我只用了两个:

--with-http_stub_status_module 通过web界面查看时nginx的并发连接数需要开启status模块
--with-http_ssl_module 开启http_ssl模块,使nginx可以支持HTTPS请求
三、nginx的停止1.Nginx支持的信号:
信号名 作用描述
TERM, INT 快速关闭程序,中止当前正在处理的请求
QUIT 处理完当前请求后,关闭程序
HUP 重新加载配置,并开启新的工作进程,关闭就的进程,此操作不会中断请求
USR1 重新打开日志文件,用于切换日志,例如每天生成一个新的日志文件
USR2 平滑升级可执行程序
WINCH 从容关闭工作进程

2.如果配置文件nginx.conf定义了pid的路径/usr/local/nginx/logs/nginx.pid,可以用该路径结束进程。重新加载配置,并开启新的工作进程,关闭旧的进程,此操作不会中断请求kill -HUP 6438(master的pid)kill -HUP `/usr/local/nginx/logs/nginx.pid`
快速关闭程序,中止当前正在处理的请求 kill -TERM 6438(master的pid)kill -TERM `/usr/local/nginx/logs/nginx.pid`
强制停止所有nginx进程pkill -9 nginx
确认nginx的配置文件是否正确[root@localhost ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

四、安装nginx
1.nginx官网,下载了目前最新的版本nginx-1.7.10.tar.gz
http://nginx.org/

2.安装依赖包和库
[root@localhost ~]#yum -y install gcc gcc-c++ autoconf automake
[root@localhost ~]#yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

3.创建用户和组
[root@localhost ~]#groupadd www
[root@localhost ~]#useradd -g www www

4.解压
[root@localhost ~]# tar -xzvf nginx-1.7.10.tar.gz
[root@localhost ~]# cd nginx-1.7.10

5.编译安装到/usr/local/nginx目录
[root@localhost nginx-1.7.10]#./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

出现这些,编译就没问题
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

6.安装
[root@localhost nginx-1.7.10]# make && make install

7.启动nginx
[root@localhost nginx-1.7.10]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

8.验证





9.创建首页测试
[root@localhost ~]# mkdir -p /var/www/bbs/
在www目录下创建index.html
在bbs目录下创建test.html
在nginx.conf文件添加:
location / {
root /var/www;
index index.html index.htm;
}

location /bbs {
root /var/www/;
index test.html;
}

10.验证首页








本文出自 “卡卡西” 博客,请务必保留此出处http://whnba.blog.51cto.com/1215711/1613706
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: