配置文件[中学]FreeBSD上搭建大型网站(Nginx代理服务器篇)

代理服务器网站  时间:2021-03-02  阅读:()

七、 Porxy服务器配置

Proxy服务器 192.168.10.20主要是负责终端客户的接入为两台Squid缓存服务器提供均衡负载。现在我们就开始吧

服务器网络配置

#ee/etc/rc.confifconfig_lnc0="inet 192.168.10.20 netmask 255.255.255.0"defaultrouter="192.168.10.10"hostname="proxy.rd.bj"

#ee/etc/hosts

192.168.10.20 proxy.rd.bj

#ee/etc/resolv.confnameserver 192.168.10.40

网络环境配置好后我们开始安装Nginx在那里告诉我

#whereis nginxnginx: /us r/ports/www/nginx

#make config

#make showconfig #我的配置选项

===>The following configuration options are available for nginx-0.5.34:

DEBUG=off"Enable nginx debugging"

HTTP_MODULE=on"Enable HTTP module"

HTTP_ADDITION_MODULE=on"Enab le http_addition module"

HTTP_DAV_MODULE=on"Enable http_webdav module"

HTTP_FLV_MODULE=on"Enable http_flv module"

HTTP_PERL_MODULE=on"Enable http_perl module"

HTTP_REALIP_MODULE=on"Enable http_realip module"

HTTP_REWRITE_MODULE=on"Enab le http_rewrite module"

HTTP_S SL_MODULE=on"Enab le http_ssl module"

HTTP_STATUS_MODULE=on"Enab le http_stub_status module"

HTTP_SUB_MODULE=on"Enable http_sub module"

MAIL_MODULE=off"Enable IMAP4/POP3/SMTP proxy module"

MAIL_IMAP_MODULE=off"Enable IMAP4 proxy module"

MAIL_POP3_MODULE=off"Enable POP3 proxy module"

MAIL_SMTP_MODULE=off"Enable SMTP proxy module"

MAIL_SSL_MODULE=off"Enable mail_ssl module"

WWW=on"Enable html sample files"

===>Use'make config' to modify these settings

#make install clean

又开始等待了 .. .

终于完了现在开始配置吧

#c d/usr/loc al/etc/nginx

#ee nginx.conf#更改配置文件

我更改后的配置文件如下us er www www;worker_processes 1;error_log/var/log/nginx_error.log;pid /var/run/nginx.pid;events {us e kqueue;worker_c onnections 65535;

}http{include mime.types;default_type application/octet-stream;log_format main'$remote_addr -$remote_user [$time_local] $request''"$s tatus"$body_bytes_s ent "$http_referer" '

'"$http_us er_ag ent" "$http_x_forw arded_for"';access_log/var/log/nginx_access.log main;c lient_he ader_timeout 3m;client_body_timeout 3m;send_timeout 3m;sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_tim eout 65;client_header_buffer_size 1k;large_c lient_header_buffers 44k;output_buffers 1 32k;pos tpone_output 1460;gzip on;gzip_min_length 1100;gzip_buffers 48k;gzip_types text/plain;

upstream mysvr {server 192.168.10.30:3128 weight=5;server 192.168.10.31:3128 weight=5;

}s erver {listen 80;s erver_name www.rd.bj;charset gbk;access_log/var/log/nginx_host.access.log main;loc ation/ {proxy_pass http://mysvr/;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 10m;client_body_buffer_size 128k;proxy_connect_timeout 90;proxy_send_timeout 90;proxy_read_timeout 90;proxy_buffer_size 4k;proxy_buffers 432k;proxy_busy_buffers_size 64k;proxy_temp_file_write_s ize 64k;

}loc ation/nginx{stub_status on;access_log on;auth_bas ic "Nginx Status";auth_bas ic_us er_file /us r/loc al/etc/nginx/htpas sw d;

}

}

}

保存配置文件退出后现在对刚才设置的文件进行验证。

#rehash

#nginx-t

2007/12/27 15:42:52[info]25243#0: the c onfiguration file/usr/loc al/etc/nginx/nginx.c onf syntax is ok2007/12/27 15:42:52[info]25243#0: the configuration file/usr/local/etc/nginx/nginx.conf was tested successfully

Very good没问题了我们在配置文件中还设置了查看Nginx的状态信息所以现在我们还必需生成一个htppas swd文件这时候我们得用到Apac he的htpassw d工具了 我们这台代理服务器上没有Apac he现在只能依靠web服务器的了去那生成一个复制过来。

生成htppas swd文件的方法

#htpas sw d-c/tmp/htpas ssw d nginx

输入两次密码就完成了然后把生成好的htpas swd文件拷贝到proxy的机器的/usr/loc al/etc/nginx目录下就行了。

如何在两台机器之间拷贝文件呢 s cp出场了.. .

#scp/tmp/htpass sw d root@192.168.10.20:/usr/loc al/etc/nginx

好了 现在万事具备了现在启动她吧  

#nginx

#ps -aux|grep nginxroot 8040.03.449084288??Ss 4:49PM 0:00.00 nginx:master process nginx(nginx)www 8050.0 13.8 1800417404??S 4:49PM 0:00.02 nginx:worker process (nginx)root 8070.00.3 536 416 p0 RL+ 4:49PM 0:00.00 grep nginx

现在用浏览器查看一下Ng inx的状态http://192.168.10.20/ng inx输入用户名和密码进入如图

Gcorelabs:美国GPU服务器,8路RTX2080Ti;2*Silver-4214/256G内存/1T SSD,1815欧/月

gcorelabs怎么样?gcorelabs是创建于2011年的俄罗斯一家IDC服务商,Gcorelabs提供优质的托管服务和VPS主机服务,Gcorelabs有一支强大的技术队伍,对主机的性能和稳定性要求非常高。Gcorelabs在 2017年收购了SkyparkCDN并提供全球CDN服务,目标是进入全球前五的网络服务商。G-Core Labs总部位于卢森堡,在莫斯科,明斯克和彼尔姆设有办事处。...

Hostwinds:免费更换IP/优惠码美元VPS免费更换IP4.99,7月最新优惠码西雅图直连VPS

hostwinds怎么样?2021年7月最新 hostwinds 优惠码整理,Hostwinds 优惠套餐整理,Hostwinds 西雅图机房直连线路 VPS 推荐,目前最低仅需 $4.99 月付,并且可以免费更换 IP 地址。本文分享整理一下最新的 Hostwinds 优惠套餐,包括托管型 VPS、无托管型 VPS、Linux VPS、Windows VPS 等多种套餐。目前 Hostwinds...

艾云年付125元圣何塞GTT,洛杉矶vps年付85元

艾云怎么样?艾云是一家去年年底成立的国人主机商家,商家主要销售基于KVM虚拟架构的VPS服务,机房目前有美国洛杉矶、圣何塞和英国伦敦,目前商家推出了一些年付特价套餐,性价比非常高,洛杉矶套餐低至85元每年,给500M带宽,可解奈飞,另外圣何塞也有特价机器;1核/1G/20G SSD/3T/2.5Gbps,有需要的朋友以入手。点击进入:艾云官方网站艾云vps促销套餐:KVM虚拟架构,自带20G的防御...

代理服务器网站为你推荐
木马病毒什么是木马病毒?51自学网站推荐一个好一点的自学网站,关于网站建设的。支付宝查询余额支付宝里如何查询银行卡里面的余额?真正免费的网络电话有没有真正免费的网络电话?而且是好用的?在线代理网站最好的免费在线代理网站有哪些~急!声母是什么什么是声母,什么是韵母域名库电脑上文件有多少域名?各什么意思?qq等级表QQ等级列表液晶显示器电源维修液晶显示器通电无显示应如何维修?1258012580是什么意思
海外域名 naning9韩国官网 主机评测 enzu 主机点评 idc测评网 iis安装教程 hostker ftp免费空间 酷番云 网游服务器 免费网页申请 香港亚马逊 测试网速命令 江苏双线 云销售系统 forwarder alexa世界排名 godaddy退款 apache启动失败 更多