(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
毕业论文答辩 题目: Ngnix 技术在互联网开发中的应用 姓名:魏文生 专业:信息与计算科学 指导老师:刘忆宁 2010.6.5  桂林电子科技大学
什么是 Nginx ? Nginx (“engine x”)  是俄罗斯人 Igor Sysoev( 塞索耶夫 ) 编写的一款高性能的  HTTP  和反向代理服务器。 Nginx  已经在俄罗斯最大的门户网站──  Rambler Media ( www.rambler.ru )上运行了 3 年时间,同时俄罗斯超过 20% 的虚拟主机平台采用 Nginx 作为反向代理服务器。 在国内,已经有 新浪博客、新浪播客、网易新闻、六间房、 56.com 、 Discuz! 、水木社区、豆瓣、 YUPOO 、海内、迅雷在线 等多家网站使用  Nginx  作为 Web 服务器或反向代理服务器。
选择 Nginx 的理由   1 、高并发连接: 官方测试能够支撑 5 万并发连接,在实际生产环境中跑到 2 ~ 3 万并发连接数。 2 、内存消耗少: 在 3 万并发连接下,开启的 10 个 Nginx  进程才消耗 150M 内存( 15M*10=150M )。 3 、配置文件非常简单: 风格跟程序一样通俗易懂。 4 、成本低廉: Nginx 为开源软件,可以免费使用。而购买 F5 BIG-IP 、 NetScaler 等硬件负载均衡交换机则需要十多万至几十万人民币。
选择 Nginx 的理由 5 、支持 Rewrite 重写规则: 能够根据域名、 URL 的不同,将  HTTP  请求分到不同的后端服务器群组。 6 、内置的健康检查功能: 如果  Nginx Proxy  后端的某台  Web  服务器宕机了,不会影响前端访问。 7 、节省带宽: 支持  GZIP  压缩,可以添加浏览器本地缓存的  Header  头。 8 、稳定性高: 用于反向代理,宕机的概率微乎其微。
单台 Nginx 支撑了高达 2.8 万的活动并发连接数
单台 Nginx 支撑了高达 2.8 万的活动并发连接数 2009-09-03 14:30 ,金山游戏《剑侠情缘网络版 3 》临时维护 1 小时,大量玩家上官网,论坛、评论、客服等动态应用 Nginx 服务器集群,每台服务器的 Nginx 活动连接数达到 2.8 万,这是本人遇到的 Nginx 生产环境最高并发值。
Nginx 的主要应用类别 1 、使用  Nginx  结合 FastCGI 运行  PHP 、 JSP  、 Perl 等程序 2 、使用  Nginx  作反向代理、负载均衡、规则过滤 3 、使用  Nginx  运行静态 HTML 页、图片 4 、 Nginx 与其他新技术的结合应用
编译安装 Nginx 1 、创建供 Nginx 使用的组和帐号: /usr/sbin/groupadd www -g 48 /usr/sbin/useradd -u 48 -g www www 2 、编译安装 rewrite 模块支持包 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz tar zxvf pcre-7.7.tar.gz cd pcre-7.7/ ./configure make && make install cd ../
编译安装 Nginx 3 、编译安装 Nginx wget http://sysoev.ru/nginx/nginx-0.7.17.tar.gz tar zxvf nginx-0.7.17.tar.gz cd nginx-0.7.17/ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module make && make install cd ../ 4 、备份默认 nginx.conf 配置文件 mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.old
创建 nginx.conf 配置文件 1 、创建 Nginx 配置文件 vi /usr/local/nginx/conf/nginx.conf  2 、输入配置文件内容 user www www; worker_processes 8; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events  { use epoll; worker_connections 51200; }
Nginx  负载均衡的典型应用
简单的 Nginx 负载均衡配置 (1) ……  upstream bbs_server_pool { server 192.168.1.15:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.16:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.17:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.18:80 weight=1 max_fails=2 fail_timeout=30s; }  …… 在 nginx.conf 配置文件中,用 upstream 指令定义一组反向代理 / 负载均衡后端服务器池。
简单的 Nginx 负载均衡配置 (2) ……  server{ listen 80; server_name bbs.yourdomain.com *.bbs.yourdomain.com; location / { proxy_pass http://bbs_server_pool; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } access_log off; } ……
简单的 Nginx 负载均衡配置 (3) proxy_pass http://bbs_server_pool;  用于指定反向代理的服务器池。 proxy_set_header Host $host;  当后端 Web 服务器上也配置有多个虚拟主机时,需要用该 Header 来区分反向代理哪个主机名。 proxy_set_header X-Forwarded-For $remote_addr;  如果后端 Web 服务器上的程序需要获取用户 IP ,请从该 Header 头获取。
启动 Nginx /usr/local/nginx/sbin/nginx –t 如果屏幕显示以下两行信息,说明配置文件正确: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully 那么,则可以启动 Nginx 服务: ulimit -SHn 51200 /usr/local/nginx/sbin/nginx
不中断服务平滑修改 Nginx 配置 ① 修改 /usr/local/nginx/conf/nginx.conf 配置文件后,请执行以下命令检查配置文件是否正确: /usr/local/nginx/sbin/nginx -t 如果屏幕显示以下两行信息,说明配置文件正确: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully ② 这时,输入以下命令查看 Nginx 主进程号: ps -ef | grep &quot;nginx: master process&quot; | grep -v &quot;grep&quot; | awk -F ' ' '{print $2}' 屏幕显示的即为 Nginx 主进程号,例如: 6302 这时,执行以下命令即可使修改过的 Nginx 配置文件生效: kill -HUP 6302 或者用更简便的方法: kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
编写每天定时切割 Nginx 日志的脚本 1 、创建脚本 /usr/local/nginx/sbin/cut_nginx_log.sh ,输入以下内容: #!/bin/bash # This script run at 00:00 # The Nginx logs path logs_path=&quot;/usr/local/nginx/logs/&quot; mkdir -p ${logs_path}$(date -d &quot;yesterday&quot; +&quot;%Y&quot;)/$(date -d &quot;yesterday&quot; +&quot;%m&quot;)/ mv ${logs_path}access.log ${logs_path}$(date -d &quot;yesterday&quot; +&quot;%Y&quot;)/$(date -d &quot;yesterday&quot; +&quot;%m&quot;)/access_$(date -d &quot;yesterday&quot; +&quot;%Y%m%d&quot;).log kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` 2 、设置 crontab ,每天凌晨 00:00 切割 nginx 访问日志 crontab -e 输入以下内容: 00 00 * * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh
总结 1 、对于中、小型企业,如果没有资金去购买昂贵的四 / 七层负载均衡交换机,那么 Nginx 是不错的七层负载均衡选择,并且可以通过  Nginx + Keepalived  实现  Nginx  负载均衡器双机互备,任意一台机器发生故障,对方都能够将虚拟 IP 接管过去。 2 、对于有资金购买四 / 七层负载均衡交换机的大型网站, Nginx 也有其用武之地。以门户类网站为例,  F5 BIG-IP 等四 / 七层交换机由于负责了全站多个产品的服务,并发数非常高,而内容转发规则等七层交换业务,用不到 F5 BIG-IP 的四层硬件芯片,极大地消耗了 F5 的 CPU 和内存资源,成为高并发应用的制约条件。而 Nginx 的出现,成为了 F5 BIG-IP 七层交换的有力补充。
结束 谢谢各位!

More Related Content

What's hot

Docker Setting for Static IP allocation
Docker Setting for Static IP allocationDocker Setting for Static IP allocation
Docker Setting for Static IP allocation
Ji-Woong Choi
 
Linux Security Crash Course
Linux Security Crash CourseLinux Security Crash Course
Linux Security Crash Course
UTD Computer Security Group
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdo
Narasimha sreeram
 
Project on squid proxy in rhel 6
Project on squid proxy in rhel 6Project on squid proxy in rhel 6
Project on squid proxy in rhel 6
Nutan Kumar Panda
 
Nginx2
Nginx2Nginx2
Nginx2
kantohibi
 
Openstack installation using rdo
Openstack installation using rdoOpenstack installation using rdo
Openstack installation using rdo
Narasimha sreeram
 
Squid Caching for Web Content Accerlation
Squid Caching for Web Content AccerlationSquid Caching for Web Content Accerlation
Squid Caching for Web Content Accerlation
rahul8590
 
信息安全监控
信息安全监控信息安全监控
信息安全监控
renren-security
 
Pf sense 2.0
Pf sense 2.0Pf sense 2.0
Pf sense 2.0
OpenFest team
 
ClickHouse column-oriented database Install memo
ClickHouse column-oriented database Install memoClickHouse column-oriented database Install memo
ClickHouse column-oriented database Install memo
Naoto MATSUMOTO
 
Intro to Exploitation
Intro to ExploitationIntro to Exploitation
Intro to Exploitation
UTD Computer Security Group
 
Linux Server Start
Linux Server StartLinux Server Start
Linux Server Start
Gavin Quan
 
Open web mail setup
Open web mail setupOpen web mail setup
Open web mail setup
Chacheng Oo
 
3 manual installation of open vpn
3 manual installation of open vpn3 manual installation of open vpn
3 manual installation of open vpn
Ashwajit Maske
 
Installing OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHELInstalling OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHEL
openstackstl
 
MariaDB ColumnStore column-oriented database Install memo
MariaDB ColumnStore column-oriented database Install memoMariaDB ColumnStore column-oriented database Install memo
MariaDB ColumnStore column-oriented database Install memo
Naoto MATSUMOTO
 
Docker 1.9 release party - Docker Ha Noi
Docker 1.9 release party - Docker Ha NoiDocker 1.9 release party - Docker Ha Noi
Docker 1.9 release party - Docker Ha Noi
Van Phuc
 
Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編
Yasuyuki Sugai
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Simon Boulet
 

What's hot (19)

Docker Setting for Static IP allocation
Docker Setting for Static IP allocationDocker Setting for Static IP allocation
Docker Setting for Static IP allocation
 
Linux Security Crash Course
Linux Security Crash CourseLinux Security Crash Course
Linux Security Crash Course
 
Openstack kilo installation using rdo
Openstack kilo installation using rdoOpenstack kilo installation using rdo
Openstack kilo installation using rdo
 
Project on squid proxy in rhel 6
Project on squid proxy in rhel 6Project on squid proxy in rhel 6
Project on squid proxy in rhel 6
 
Nginx2
Nginx2Nginx2
Nginx2
 
Openstack installation using rdo
Openstack installation using rdoOpenstack installation using rdo
Openstack installation using rdo
 
Squid Caching for Web Content Accerlation
Squid Caching for Web Content AccerlationSquid Caching for Web Content Accerlation
Squid Caching for Web Content Accerlation
 
信息安全监控
信息安全监控信息安全监控
信息安全监控
 
Pf sense 2.0
Pf sense 2.0Pf sense 2.0
Pf sense 2.0
 
ClickHouse column-oriented database Install memo
ClickHouse column-oriented database Install memoClickHouse column-oriented database Install memo
ClickHouse column-oriented database Install memo
 
Intro to Exploitation
Intro to ExploitationIntro to Exploitation
Intro to Exploitation
 
Linux Server Start
Linux Server StartLinux Server Start
Linux Server Start
 
Open web mail setup
Open web mail setupOpen web mail setup
Open web mail setup
 
3 manual installation of open vpn
3 manual installation of open vpn3 manual installation of open vpn
3 manual installation of open vpn
 
Installing OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHELInstalling OpenStack Juno using RDO on RHEL
Installing OpenStack Juno using RDO on RHEL
 
MariaDB ColumnStore column-oriented database Install memo
MariaDB ColumnStore column-oriented database Install memoMariaDB ColumnStore column-oriented database Install memo
MariaDB ColumnStore column-oriented database Install memo
 
Docker 1.9 release party - Docker Ha Noi
Docker 1.9 release party - Docker Ha NoiDocker 1.9 release party - Docker Ha Noi
Docker 1.9 release party - Docker Ha Noi
 
Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 

Viewers also liked

移动平台之于开发者调查结果揭晓
移动平台之于开发者调查结果揭晓移动平台之于开发者调查结果揭晓
移动平台之于开发者调查结果揭晓
wensheng wei
 
画WEB流程图的一点心得
画WEB流程图的一点心得画WEB流程图的一点心得
画WEB流程图的一点心得
wensheng wei
 
常用的CSS样式备份精华
常用的CSS样式备份精华常用的CSS样式备份精华
常用的CSS样式备份精华
wensheng wei
 
unixtoolbox
unixtoolboxunixtoolbox
unixtoolbox
wensheng wei
 

Viewers also liked (6)

张宴NGINX
张宴NGINX张宴NGINX
张宴NGINX
 
Лунная Гонка
Лунная ГонкаЛунная Гонка
Лунная Гонка
 
移动平台之于开发者调查结果揭晓
移动平台之于开发者调查结果揭晓移动平台之于开发者调查结果揭晓
移动平台之于开发者调查结果揭晓
 
画WEB流程图的一点心得
画WEB流程图的一点心得画WEB流程图的一点心得
画WEB流程图的一点心得
 
常用的CSS样式备份精华
常用的CSS样式备份精华常用的CSS样式备份精华
常用的CSS样式备份精华
 
unixtoolbox
unixtoolboxunixtoolbox
unixtoolbox
 

Similar to 论文答辩

Install nginx on ubuntu 21.04 server
Install nginx on ubuntu 21.04 serverInstall nginx on ubuntu 21.04 server
Install nginx on ubuntu 21.04 server
LinuxConcept
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
wruben
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
NGINX, Inc.
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEA
NGINX, Inc.
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
 
20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I
Taien Wang
 
NGINX ADC: Basics and Best Practices
NGINX ADC: Basics and Best PracticesNGINX ADC: Basics and Best Practices
NGINX ADC: Basics and Best Practices
NGINX, Inc.
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS Cluster
Kevin Jones
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Ortus Solutions, Corp
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocity
sarahnovotny
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
Yiwei Ma
 
Deploying nginx with minimal system resources
Deploying nginx with minimal system resourcesDeploying nginx with minimal system resources
Deploying nginx with minimal system resources
Max Ukhanov
 
Devopstore
DevopstoreDevopstore
Devopstore
Farkhad Badalov
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
Salesforce Developers
 
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX: Basics & Best Practices - EMEA BroadcastNGINX: Basics & Best Practices - EMEA Broadcast
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX, Inc.
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
Ben Hall
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
leffen
 
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Codemotion
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
Binary Studio
 
How to secure nginx server using fail2ban on Centos-7
How to secure nginx server using fail2ban on Centos-7How to secure nginx server using fail2ban on Centos-7
How to secure nginx server using fail2ban on Centos-7
Bhadreshsinh Gohil
 

Similar to 论文答辩 (20)

Install nginx on ubuntu 21.04 server
Install nginx on ubuntu 21.04 serverInstall nginx on ubuntu 21.04 server
Install nginx on ubuntu 21.04 server
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEA
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I20151229 wnmp & phalcon micro app - part I
20151229 wnmp & phalcon micro app - part I
 
NGINX ADC: Basics and Best Practices
NGINX ADC: Basics and Best PracticesNGINX ADC: Basics and Best Practices
NGINX ADC: Basics and Best Practices
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS Cluster
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocity
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Deploying nginx with minimal system resources
Deploying nginx with minimal system resourcesDeploying nginx with minimal system resources
Deploying nginx with minimal system resources
 
Devopstore
DevopstoreDevopstore
Devopstore
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX: Basics & Best Practices - EMEA BroadcastNGINX: Basics & Best Practices - EMEA Broadcast
NGINX: Basics & Best Practices - EMEA Broadcast
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
Nginx for Fun & Performance - Philipp Krenn - Codemotion Rome 2015
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
How to secure nginx server using fail2ban on Centos-7
How to secure nginx server using fail2ban on Centos-7How to secure nginx server using fail2ban on Centos-7
How to secure nginx server using fail2ban on Centos-7
 

More from wensheng wei

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园
wensheng wei
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)
wensheng wei
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...
wensheng wei
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术
wensheng wei
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施
wensheng wei
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zend
wensheng wei
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journey
wensheng wei
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶
wensheng wei
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
wensheng wei
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解
wensheng wei
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
wensheng wei
 
issue35 zh-CN
issue35 zh-CNissue35 zh-CN
issue35 zh-CN
wensheng wei
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法
wensheng wei
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10
wensheng wei
 
ubunturef
ubunturefubunturef
ubunturef
wensheng wei
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧
wensheng wei
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件
wensheng wei
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数
wensheng wei
 

More from wensheng wei (20)

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)
 
我的简历
我的简历我的简历
我的简历
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zend
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journey
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
issue35 zh-CN
issue35 zh-CNissue35 zh-CN
issue35 zh-CN
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法
 
Subversion FAQ
Subversion FAQSubversion FAQ
Subversion FAQ
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10
 
ubunturef
ubunturefubunturef
ubunturef
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数
 

Recently uploaded

Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
siddu769252
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Zilliz
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
SAI KAILASH R
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
Priyanka Aash
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
FIDO Alliance
 
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python CodebaseEuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
Jimmy Lai
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
Zilliz
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
DianaGray10
 
The History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal EmbeddingsThe History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal Embeddings
Zilliz
 
The Impact of the Internet of Things (IoT) on Smart Homes and Cities
The Impact of the Internet of Things (IoT) on Smart Homes and CitiesThe Impact of the Internet of Things (IoT) on Smart Homes and Cities
The Impact of the Internet of Things (IoT) on Smart Homes and Cities
Arpan Buwa
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
AmandaCheung15
 
LeadMagnet IQ Review: Unlock the Secret to Effortless Traffic and Leads.pdf
LeadMagnet IQ Review:  Unlock the Secret to Effortless Traffic and Leads.pdfLeadMagnet IQ Review:  Unlock the Secret to Effortless Traffic and Leads.pdf
LeadMagnet IQ Review: Unlock the Secret to Effortless Traffic and Leads.pdf
SelfMade bd
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
Steven Carlson
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
bellared2
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
Matthias Neugebauer
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
Ivanti
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
David Wilson
 
Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)
Debmalya Biswas
 

Recently uploaded (20)

Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
 
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python CodebaseEuroPython 2024 - Streamlining Testing in a Large Python Codebase
EuroPython 2024 - Streamlining Testing in a Large Python Codebase
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
 
The History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal EmbeddingsThe History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal Embeddings
 
The Impact of the Internet of Things (IoT) on Smart Homes and Cities
The Impact of the Internet of Things (IoT) on Smart Homes and CitiesThe Impact of the Internet of Things (IoT) on Smart Homes and Cities
The Impact of the Internet of Things (IoT) on Smart Homes and Cities
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
 
LeadMagnet IQ Review: Unlock the Secret to Effortless Traffic and Leads.pdf
LeadMagnet IQ Review:  Unlock the Secret to Effortless Traffic and Leads.pdfLeadMagnet IQ Review:  Unlock the Secret to Effortless Traffic and Leads.pdf
LeadMagnet IQ Review: Unlock the Secret to Effortless Traffic and Leads.pdf
 
Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
 
Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)Gen AI: Privacy Risks of Large Language Models (LLMs)
Gen AI: Privacy Risks of Large Language Models (LLMs)
 

论文答辩

  • 1. 毕业论文答辩 题目: Ngnix 技术在互联网开发中的应用 姓名:魏文生 专业:信息与计算科学 指导老师:刘忆宁 2010.6.5 桂林电子科技大学
  • 2. 什么是 Nginx ? Nginx (“engine x”) 是俄罗斯人 Igor Sysoev( 塞索耶夫 ) 编写的一款高性能的 HTTP 和反向代理服务器。 Nginx 已经在俄罗斯最大的门户网站── Rambler Media ( www.rambler.ru )上运行了 3 年时间,同时俄罗斯超过 20% 的虚拟主机平台采用 Nginx 作为反向代理服务器。 在国内,已经有 新浪博客、新浪播客、网易新闻、六间房、 56.com 、 Discuz! 、水木社区、豆瓣、 YUPOO 、海内、迅雷在线 等多家网站使用 Nginx 作为 Web 服务器或反向代理服务器。
  • 3. 选择 Nginx 的理由 1 、高并发连接: 官方测试能够支撑 5 万并发连接,在实际生产环境中跑到 2 ~ 3 万并发连接数。 2 、内存消耗少: 在 3 万并发连接下,开启的 10 个 Nginx 进程才消耗 150M 内存( 15M*10=150M )。 3 、配置文件非常简单: 风格跟程序一样通俗易懂。 4 、成本低廉: Nginx 为开源软件,可以免费使用。而购买 F5 BIG-IP 、 NetScaler 等硬件负载均衡交换机则需要十多万至几十万人民币。
  • 4. 选择 Nginx 的理由 5 、支持 Rewrite 重写规则: 能够根据域名、 URL 的不同,将 HTTP 请求分到不同的后端服务器群组。 6 、内置的健康检查功能: 如果 Nginx Proxy 后端的某台 Web 服务器宕机了,不会影响前端访问。 7 、节省带宽: 支持 GZIP 压缩,可以添加浏览器本地缓存的 Header 头。 8 、稳定性高: 用于反向代理,宕机的概率微乎其微。
  • 5. 单台 Nginx 支撑了高达 2.8 万的活动并发连接数
  • 6. 单台 Nginx 支撑了高达 2.8 万的活动并发连接数 2009-09-03 14:30 ,金山游戏《剑侠情缘网络版 3 》临时维护 1 小时,大量玩家上官网,论坛、评论、客服等动态应用 Nginx 服务器集群,每台服务器的 Nginx 活动连接数达到 2.8 万,这是本人遇到的 Nginx 生产环境最高并发值。
  • 7. Nginx 的主要应用类别 1 、使用 Nginx 结合 FastCGI 运行 PHP 、 JSP 、 Perl 等程序 2 、使用 Nginx 作反向代理、负载均衡、规则过滤 3 、使用 Nginx 运行静态 HTML 页、图片 4 、 Nginx 与其他新技术的结合应用
  • 8. 编译安装 Nginx 1 、创建供 Nginx 使用的组和帐号: /usr/sbin/groupadd www -g 48 /usr/sbin/useradd -u 48 -g www www 2 、编译安装 rewrite 模块支持包 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.7.tar.gz tar zxvf pcre-7.7.tar.gz cd pcre-7.7/ ./configure make && make install cd ../
  • 9. 编译安装 Nginx 3 、编译安装 Nginx wget http://sysoev.ru/nginx/nginx-0.7.17.tar.gz tar zxvf nginx-0.7.17.tar.gz cd nginx-0.7.17/ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module make && make install cd ../ 4 、备份默认 nginx.conf 配置文件 mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.old
  • 10. 创建 nginx.conf 配置文件 1 、创建 Nginx 配置文件 vi /usr/local/nginx/conf/nginx.conf 2 、输入配置文件内容 user www www; worker_processes 8; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; }
  • 12. 简单的 Nginx 负载均衡配置 (1) …… upstream bbs_server_pool { server 192.168.1.15:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.16:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.17:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.1.18:80 weight=1 max_fails=2 fail_timeout=30s; } …… 在 nginx.conf 配置文件中,用 upstream 指令定义一组反向代理 / 负载均衡后端服务器池。
  • 13. 简单的 Nginx 负载均衡配置 (2) …… server{ listen 80; server_name bbs.yourdomain.com *.bbs.yourdomain.com; location / { proxy_pass http://bbs_server_pool; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } access_log off; } ……
  • 14. 简单的 Nginx 负载均衡配置 (3) proxy_pass http://bbs_server_pool; 用于指定反向代理的服务器池。 proxy_set_header Host $host; 当后端 Web 服务器上也配置有多个虚拟主机时,需要用该 Header 来区分反向代理哪个主机名。 proxy_set_header X-Forwarded-For $remote_addr; 如果后端 Web 服务器上的程序需要获取用户 IP ,请从该 Header 头获取。
  • 15. 启动 Nginx /usr/local/nginx/sbin/nginx –t 如果屏幕显示以下两行信息,说明配置文件正确: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully 那么,则可以启动 Nginx 服务: ulimit -SHn 51200 /usr/local/nginx/sbin/nginx
  • 16. 不中断服务平滑修改 Nginx 配置 ① 修改 /usr/local/nginx/conf/nginx.conf 配置文件后,请执行以下命令检查配置文件是否正确: /usr/local/nginx/sbin/nginx -t 如果屏幕显示以下两行信息,说明配置文件正确: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully ② 这时,输入以下命令查看 Nginx 主进程号: ps -ef | grep &quot;nginx: master process&quot; | grep -v &quot;grep&quot; | awk -F ' ' '{print $2}' 屏幕显示的即为 Nginx 主进程号,例如: 6302 这时,执行以下命令即可使修改过的 Nginx 配置文件生效: kill -HUP 6302 或者用更简便的方法: kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
  • 17. 编写每天定时切割 Nginx 日志的脚本 1 、创建脚本 /usr/local/nginx/sbin/cut_nginx_log.sh ,输入以下内容: #!/bin/bash # This script run at 00:00 # The Nginx logs path logs_path=&quot;/usr/local/nginx/logs/&quot; mkdir -p ${logs_path}$(date -d &quot;yesterday&quot; +&quot;%Y&quot;)/$(date -d &quot;yesterday&quot; +&quot;%m&quot;)/ mv ${logs_path}access.log ${logs_path}$(date -d &quot;yesterday&quot; +&quot;%Y&quot;)/$(date -d &quot;yesterday&quot; +&quot;%m&quot;)/access_$(date -d &quot;yesterday&quot; +&quot;%Y%m%d&quot;).log kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` 2 、设置 crontab ,每天凌晨 00:00 切割 nginx 访问日志 crontab -e 输入以下内容: 00 00 * * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh
  • 18. 总结 1 、对于中、小型企业,如果没有资金去购买昂贵的四 / 七层负载均衡交换机,那么 Nginx 是不错的七层负载均衡选择,并且可以通过 Nginx + Keepalived 实现 Nginx 负载均衡器双机互备,任意一台机器发生故障,对方都能够将虚拟 IP 接管过去。 2 、对于有资金购买四 / 七层负载均衡交换机的大型网站, Nginx 也有其用武之地。以门户类网站为例, F5 BIG-IP 等四 / 七层交换机由于负责了全站多个产品的服务,并发数非常高,而内容转发规则等七层交换业务,用不到 F5 BIG-IP 的四层硬件芯片,极大地消耗了 F5 的 CPU 和内存资源,成为高并发应用的制约条件。而 Nginx 的出现,成为了 F5 BIG-IP 七层交换的有力补充。