Nginx
此章节介绍大文件传输平台BFT7.5.1可选模块Nginx安装,启动,控制管理中心,管理服务器,日志中心,代理节点集群配置
Nginx安装
1.安装编译工具及库文件
[root@localhost /]#yum -y install make zlib zlib-devel gcc-c++ libtool
openssl openssl-devel
2.下载 Nginx
方法一:通过浏览器下载后上传至待部署的服务器,下载地址:https://nginx.org/en/download.html
方法二:在服务器指定目录下通过wget下载 wget http://nginx.org/download/nginx-1.16.1.tar.gz
3.编译安装
[root@localhost nginx-1.16.1]# ./configure --prefix=/usr/local/nginx
[root@localhost nginx-1.16.1]# make
[root@localhost nginx-1.16.1]# make install
4.查看nginx版本
[root@localhost nginx-1.16.1]# /usr/local/webserver/nginx/sbin/nginx -v
5.nginx启停
/usr/local/nginx/sbin/nginx # 启动
/usr/local/nginx/sbin/nginx -s reload # 重新载入配置文件
/usr/local/nginx/sbin/nginx -s reopen # 重启 Nginx
/usr/local/nginx/sbin/nginx -s stop # 停止 Nginx
Console集群配置
在nginx.conf文件中的http{}模块中增加以下内容,启动nginx
http {
...(略)
#gzip on;
#实际访问的后端端口(根据Console配置信息填写),轮询方式:默认方式轮询
upstream bftconsole {
server 192.168.30.141:28082;
server 192.168.30.144:28082;
}
server {
listen 28082;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://bftconsole;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Server集群配置
在nginx.conf文件中的http{}模块中增加以下内容,启动nginx
http {
...(略)
#gzip on;
#实际访问的后端端口(根据Server配置信息填写),轮询方式:默认方式轮询
upstream bftServer {
server 192.168.30.141:6311;
server 192.168.30.144:6311;
}
server {
listen 6311;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://bftServer;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Logcenter集群配置
在nginx.conf文件中的http{}模块中增加以下内容,启动nginx
http {
...(略)
#gzip on;
#实际访问的后端端口(根据Logcenter配置信息填写),轮询方式:默认方式轮询
upstream bftLogcenter {
server 192.168.30.141:29898;
server 192.168.30.144:29898;
}
server {
listen 29898;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://bftLogcenter;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Agent集群配置
http {
...(略)
#gzip on;
#实际访问的后端端口(根据Agent配置信息填写),轮询方式:默认方式轮询
upstream bftAgent {
server 192.168.30.141:7081;
server 192.168.30.144:7081;
}
server {
listen 7081;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://bftAgent;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}