重庆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: /usr/ports/www/nginx

#make config

#make showconfig #我的配置选项

===>The fol lowing configuration options are avai lable fornginx-0.5.34:

DEBUG=off"Enable nginxdebugging"

HTTP_MODULE=on "Enable HTTP module"

HTTP_ADDITION_MODULE=on"Enable 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_real ip module"

HTTP_REWRITE_MODULE=on"Enable http_rewrite module"HTTP_SSL_MODULE=on"Enable http_ssl module"

HTTP_STATUS_MODULE=on"Enable 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 mai l_ssl module"

WWW=on "Enable html sample fi les"

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

#make instal l clean

又开始等待了. . .

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

#cd/usr/local/etc/nginx

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

我更改后的配置文件如下u se r www www;worker_processes 1 ;error_log/var/log/nginx_error. log;pid /var/run/nginx.pid;events{use kqueue;worker_connections 65535;

}http{include mime.types;default_type appl ication/octet-stream;log_format main'$remote_addr -$remote_user [$time_local]$request ''"$status"$body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"' ;access_log/var/log/nginx_access. log main;

重庆SEO http://www cqseo org 重庆网站建设http://www zl5 infocl ient_header_timeout 3m;cl ient_body_timeout 3m;send_timeout 3m;sendfi le on;tcp_nopush on;tcp_nodelay on;keepal ive_timeout 65;cl ient_header_buffer_size 1k;large_cl ient_header_buffers 44k;output_buffers 1 32k;postpone_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;

}server{l isten 80;se rve r_na me www.zl5. i nfo;charset gbk;access_log/var/log/nginx_host.access. log main;location/ {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$p roxy_ad d_x_fo rwa rd ed_for;cl ient_max_body_size 10m;cl ient_body_buffer_size 128k;proxy_connect_timeout 90;

重庆B2B联盟http://www xqylm com鹭佳财务有限公司http://www ljcw 168 com

proxy_send_timeout 90;proxy_read_timeout 90;proxy_buffer_size 4k;proxy_buffers 432k;proxy_busy_buffers_size 64k;proxy_temp_fi le_write_size 64k;

}location/nginx{stub_status on;access_log on;auth_basic "NginxStatus";auth_basic_user_fi le /usr/local/etc/nginx/htpasswd;

}

}

}

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

#rehash

#nginx-t

2007/12/27 15:42:52 [info] 25243#0: the configuration fi le/usr/local/etc/nginx/nginx.confsyntax is ok

2007/12/27 15:42:52 [info] 25243#0: the configuration fi le/usr/local/etc/nginx/nginx.confwas tested successful ly

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

#htpasswd-c/tmp/htpassswd nginx

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

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

#scp/tmp/htpassswd root@192.168.10.20:/usr/local/etc/nginx

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

#nginx

#ps-aux|grep nginxroot 8040.03.449084288??Ss 4:49PM 0:00.00 nginx:master process nginx(nginx)www 8050.013.81800417404??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

现在用浏览器查看一下Nginx的状态 http://192.168.10.20/nginx输入用户名和密码进入

重庆SEO http://www cqseo org 重庆网站建设http://www zl5 info

如图

好了 Nginx也配置完成了。

重庆B2B联盟http://www xqylm com鹭佳财务有限公司http://www ljcw 168 com

RAKsmart便宜美国/日本/中国香港VPS主机 低至月$1.99 可安装Windows

RAKsmart 商家这几年还是在做事情的,虽然他们家顺带做的VPS主机并不是主营业务,毕竟当下的基础云服务器竞争过于激烈,他们家主营业务的独立服务器。包括在去年开始有新增多个数据中心独立服务器,包括有10G带宽的不限流量的独立服务器。当然,如果有需要便宜VPS主机的他们家也是有的,比如有最低月付1.99美元的美国VPS主机,而且可选安装Windows系统。这里商家有提供下面六款六月份的活动便宜V...

pigyun25元/月,香港云服务器仅起;韩国云服务器,美国CUVIP

pigyun怎么样?PIGYun成立于2019年,2021是PIGYun为用户提供稳定服务的第三年,期待我们携手共进、互利共赢。PIGYun为您提供:香港CN2线路、韩国CN2线路、美西CUVIP-9929线路优质IaaS服务。月付另有通用循环优惠码:PIGYun,获取8折循环优惠(永久有效)。目前,PIGYun提供的香港cn2云服务器仅29元/月起;韩国cn2云服务器仅22元/月起;美国CUVI...

昔日数据:香港云服务器(2G防御)、湖北云服务器(100G防御),首月5折,低至12元/月

昔日数据,国内商家,成立于2020年,主要销售湖北十堰和香港HKBN的云服务器,采用KVM虚拟化技术构架,不限制流量。当前夏季促销活动,全部首月5折促销,活动截止于8月11日。官方网站:https://www.xrapi.cn/5折优惠码:XR2021湖北十堰云服务器托管于湖北十堰市IDC数据中心,母鸡采用e5 2651v2,SSD MLC企业硬盘、 rdid5阵列为数据护航,100G高防,超出防...

代理服务器网站为你推荐
安装程序配置服务器失败SQL安装程序配置服务器失败支付宝查询余额怎么查询支付宝里的余额arm开发板ARM开发板具体有什么作用?有什么商业价值?iphone越狱后怎么恢复已经越狱的iphone怎么恢复到原来的系统bt封杀BT下载可以封杀迅雷吗?什么原理?能破吗?iphone6上市时间苹果6什么时候出?多少钱网站推广外链我是新手SEO,请问网站怎样做外链推广防钓鱼无线防钓鱼 什么意思手工杀毒蠕虫病毒怎么手工杀毒厦门铁通福建厦门铁通 最近怎么了
广西虚拟主机 域名系统 如何查询ip地址 a5域名交易 过期域名抢注 cn域名个人注册 fdcservers 便宜建站 哈喽图床 京东云擎 好看的桌面背景图片 主机合租 南昌服务器托管 权嘉云 怎么测试下载速度 电信虚拟主机 电信主机 重庆电信服务器托管 免费ftp photobucket 更多