反向代理服务器的配置及管理

上传人:wt****50 文档编号:37837290 上传时间:2018-04-23 格式:DOC 页数:7 大小:70.50KB
返回 下载 相关 举报
反向代理服务器的配置及管理_第1页
第1页 / 共7页
反向代理服务器的配置及管理_第2页
第2页 / 共7页
反向代理服务器的配置及管理_第3页
第3页 / 共7页
反向代理服务器的配置及管理_第4页
第4页 / 共7页
反向代理服务器的配置及管理_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《反向代理服务器的配置及管理》由会员分享,可在线阅读,更多相关《反向代理服务器的配置及管理(7页珍藏版)》请在金锄头文库上搜索。

1、反向代理服务器的配置及管理反向代理服务器的配置及管理Author:李洪涛 Mail: 反向代理软件:nginx 主要支持的协议 http、https、pop3、smtp、imap 等一、引言一、引言Nginx 介绍介绍Nginx 发音为engine x,是由俄罗斯人 Igor Sysoev 建立的项目,基于 BSD 许可。 据说他当初是 F5 的成员之一,英文主页:http:/ 它超过两年多了, 一直表现不凡,从 nginx 的维基百科网站也能了解到,国内很多的大型 门户网站已经都在使用,比如网易、新浪、腾讯等。所以 nginx 的使用已经有一些成功的 案例,这为我们使用这个代理软件提供了很好

2、的背景。二、反向代理服务器的作用二、反向代理服务器的作用目前来说反向代理服务器基于安全和性能两个主要的方面考虑,下面是一个反向代理的拓 扑模型:2.1 基于安全:基于安全:云客户端发来的请求不是直接的与内容服务器、数据库或者应用通信,他们首先到达 反向代理服务器,防火墙只授信反向代理服务器与内容服务器等的内部真实服务器的通信, 这样就使得内部真实的服务器受到了保护,代理服务器成为一道屏障,来自云端的攻击最 多到达反向代理这个环节。2.3 基于性能基于性能起到高速缓冲加速的功能。反向代理服务器可以在实现缓存云端访问实际应用过程中 各种数据,当云端用户访问的数据已经在反向代理中缓存,那么反向代理会

3、很快响应用户 的请求,而不必转发请求到真实的内部服务器上去再次提取。对于应用来说这样的架构就 起到了一个加速缓冲的作用。三、三、Nginx 的安装的安装下载 nginx 的源包:http:/www.ngin.org 下载当前稳定版 解包:tar zxvf *.tar.gz 或者 tar xvf *.tar.gz 进入加压后的包,执行安装配置:1. ./configure 2. -prefix=/usr/local/php-fcgi 3. -with-web_mail 4. -with-http_ssl_moudel 5. -enable-fastcgi 6. -enable-discard-p

4、ath 7. -enable-force-cgi-redirect 8. -with-config-file-path=/usr/local/php-fcgi/etc 9. -enable-zend-multibyte 10. -with-mysql=/usr/local/mysql 11. -with-libxml-dir=/usr/local/libxml2 12. -with-gd=/usr/local/gd2 13. -with-jpeg-dir 14. -with-png-dir 15. -with-bz2 16. -with-freetype-dir 17. -with-iconv

5、-dir 18. -with-zlib-dir 19. -with-openssl=/usr/local/openssl 20. -with-mcrypt=/usr/local/libmcrypt 21. -enable-sysvsem 22. -enable-inline-optimization 23. -enable-soap 24. -enable-gd-native-ttf 25. -enable-ftp 26. -enable-mbstring 27. -enable-exif 28. -disable-debug 29. -disable-ipv6 30.对于我们的 nginx

6、最主要的是需要这两个参数:31. -with-web_mail 32. -with-http_ssl_moudel 编译:make 安装:make install四、四、nginx 配置配置修改配置文件:/etc/nginx/conf/nginx.conf 路径在安装路径下,我在其中做详细解析; 将下面的“worker_processes 1”改成“worker_processes 5” 。user nginx nginx; /如果为 nginx 设置了相应的用户和组,需要在这里设定 worker_processes 1; /启动进程,这个可以根据 nginx 所在服务器的配置设定/日志的记录

7、格式,下面是针对 error 日志 error_log logs/error.log; error_log logs/error.log notice; error_log logs/error.log info;pid logs/nginx.pid; /pid 文件放置的位置/工作模式及连接数上限,这个结合操作系统限制上限来设置 events use epoll;worker_connections 1024; /配置邮件代理服务 mail auth_http 127.0.0.1:8080/mail/auth.php; /pop、smtp、imap 等用户跳转验证脚本页面pop3_capab

8、ilities “TOP“ “USER“;imap_capabilities “IMAP4rev1“ “UIDPLUS“;server listen 110;protocol pop3;proxy on;server listen 143;protocol imap;proxy on;server listen 25;protocol smtp;proxy on;/配置 http 代理服务的部分 http include mime.types; / mime.types 设置访问的文件类型default_type application/octet-stream;/设定客户端响应超时大小等策略

9、client_header_timeout 3m;client_body_timeout 3m;send_timeout 3m;sendfile on;tcp_nopush on;tcp_nodelay on;keepalive_timeout 65; /反向代理虚拟主机设定server listen 80; /反向代理监听 80 端口server_name ; /反向代理域名location / proxy_pass http:/ /访问 方向代理 会转向到的实际服务域名 http:/ default; /下面和上面类似,只是建立了多个虚拟主机server listen 80;server

10、_name ;location / proxy_pass http:/ default;server listen 80;server_name ;location / proxy_pass http:/ default;server listen 80;server_name ;location / proxy_pass http:/ default;server listen 80;server_name ; location / proxy_pass http:/ default;server listen 80;server_name ;location / proxy_pass ht

11、tp:/ default;server listen 80;server_name ;location / proxy_pass http:/ default;server listen 80;server_name 124.127.119.132;location /NginxStatus stub_status on;access_log on;auth_basic “NginxStatus“;auth_basic_user_file htpasswd;error_page 500 502 503 504 /50x.html;location = /50x.html root html;

12、五、五、Nginx 的管理的管理检查 nginx 配置文件语法:nginx t 首先必须定位到启动文件路径下; 检查版本:nginx v,首先必须定位到启动文件路径下; 检查安装选用的选项:nginx V 如果 nginx 被加入到了系统服务启动项中在采用下面的方式: Nginx 的启动和关闭: Service nginx start Service nginx stop如果没有,则进入到 nginx 的/etc/nginx/sbin 路径下: 启动采用./nginx 此脚本为 mail 代理实现的脚本具 体的 url 位置,官方建议采用 php 脚本来实现,采用 apache 作为 web 引擎。 具体脚本放在具体脚本放在 apache 目录下:目录下:/srv/www/htdoc/mail/auth.php七、七、Nginx 的调优配置的调优配置需要测试得知; 有待补充。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号