nginx简介与安装配置
来源:互联网 发布:数据恢复大师官网 编辑:程序博客网 时间:2024/06/04 19:22
1:nginx简介:
是个服务器,主要是php常用到的服务器。
Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、新浪、网易、腾讯等。
优点是可以在大多数 Unix like OS 上编译运行,并有 Windows 移植版。 Nginx 的1.4.0稳定版已经于2013年4月24日发布,一般情况下,对于新建站点,建议使用最新稳定版作为生产版本,已有站点的升级急迫性不高。Nginx 的源代码使用 2-clause BSD-like license。
Nginx 是一个很强大的高性能Web和反向代理服务器,它具有很多非常优越的特性:nginx有社区版,商业版/企业版(nginx_plus)
2:nginx特性:
2.1高可靠性:
架构模式:master/worker
2.2热部署:
不停止服务,而更新配置文件,更换日志文件,更新服务器版本(平缓迁移)
低内存消耗。10000个keep-alive连接模式下的非活动连接,仅需要消耗2.5M内存。
2.3:基本功能:
静态资源的web服务器:
http协议的反向代理服务:
Pop3,smpt,imap4等邮件协议的反向代理
能缓存打开的文件(元数据),支持FastCGI(php_fpm),uWSGI(pythonweb framework)等协议。
模块化(非DSO机制),过滤器zip,SSI,SSL;
2.4:web服务相关功能:虚拟主机(server),keeyalive,访问日志(支持基于日志缓冲提高其性能),url rewrite,
路径别名,基于ip及用户的访问控制,速率限制,并发数限制。
2.5:nginx基本架构:模式;Master/worker
一个master进程,可生成一个或多个worker进程;
事件驱动:epoll(linux),kqueue(FreeBSD),/dev/poll(Solarls)
消息通知:select,poll,rt signals
支持sendfile,sendfile64
支持AIO,mmap
master:加载配置文件,管理worker进程,平滑升级,,
worker:http服务,http代理,fastcgi代理。。。
nginx模块类型:
核心模块:coremodule
Standard HTTP modules(标准的)
Options HTTP modules(可选的)
Mail modules
第三方模块(需要在编译时,手动指明加载方式加载)
nginx用来做什么:
静态资源的web服务器;
http服务器的反向代理;
什么是代理;
正向:站着客户端前端,为所有客户端访问所有站点,或者说大多数站点提供代理。
反向代理:为某一个,或者有限几个服务器的前端,为这个服务器做代理
反向代理实现负载均衡
nginx主要用来做反代,要么用来做静态http服务器。
3.nginx安装:
3.1编译安装:
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --with-debug编译过程中会有一大堆check
checkingfor OS
+ Linux 3.10.0-229.el7.x86_64 x86_64
checkingfor C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8.5 20150623 (Red Hat4.8.5-11) (GCC)
checkingfor gcc -pipe switch ... found
checkingfor gcc variadic macros ... found
checkingfor C99 variadic macros ... found
checkingfor unistd.h ... found
checkingfor inttypes.h ... found
checkingfor limits.h ... found
checkingfor sys/filio.h ... not found
checkingfor sys/param.h ... found
checkingfor sys/mount.h ... found
checkingfor sys/statvfs.h ... found
checkingfor crypt.h ... found
checkingfor Linux specific features
checkingfor epoll ... found
checkingfor sendfile() ... found
checkingfor sendfile64() ... found
checkingfor sys/prctl.h ... found
checkingfor prctl(PR_SET_DUMPABLE) ... found
checkingfor sched_setaffinity() ... found
checkingfor crypt_r() ... found
checkingfor sys/vfs.h ... found
checkingfor poll() ... found
checkingfor /dev/poll ... not found
checkingfor kqueue ... not found
checkingfor crypt() ... not found
checkingfor crypt() in libcrypt ... found
checkingfor O_DIRECT ... found
checkingfor F_NOCACHE ... not found
checkingfor directio() ... not found
checkingfor statfs() ... found
checkingfor statvfs() ... found
checkingfor dlopen() ... not found
checkingfor dlopen() in libdl ... found
checkingfor sched_yield() ... found
checkingfor PCRE library ... found
checkingfor OpenSSL library ... found
checkingfor zlib library ... found
creatingobjs/Makefile
checkingfor int size ... 4 bytes
checkingfor long size ... 8 bytes
checkingfor long long size ... 8 bytes
checkingfor void * size ... 8 bytes
checkingfor uint64_t ... found
checkingfor sig_atomic_t ... found
checkingfor sig_atomic_t size ... 4 bytes
checkingfor socklen_t ... found
checkingfor in_addr_t ... found
checkingfor in_port_t ... found
checkingfor rlim_t ... found
checkingfor uintptr_t ... uintptr_t found
checkingfor system endianess ... little endianess
checkingfor size_t size ... 8 bytes
checkingfor off_t size ... 8 bytes
checkingfor time_t size ... 8 bytes
checkingfor setproctitle() ... not found
checkingfor pread() ... found
checkingfor pwrite() ... found
checkingfor strerror_r() ... found but is not working
checkingfor gnu style strerror_r() ... found
checkingfor sys_errlist[] ... found
checkingfor localtime_r() ... found
checkingfor posix_memalign() ... found
checkingfor memalign() ... found
checkingfor mmap(MAP_ANON|MAP_SHARED) ... found
checkingfor mmap("/dev/zero", MAP_SHARED) ... found
checkingfor System V shared memory ... found
checkingfor struct msghdr.msg_control ... found
checkingfor ioctl(FIONBIO) ... found
checkingfor struct tm.tm_gmtoff ... found
checkingfor struct dirent.d_namlen ... not found
checkingfor struct dirent.d_type ... found
Configurationsummary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1 library is not used
+ using system zlib library
nginx path prefix:"/usr/local/nginx"
nginx binary file:"/usr/local/nginx/sbin/nginx"
nginx configuration prefix:"/etc/nginx"
nginx configuration file:"/etc/nginx/nginx.conf"
nginx pid file:"/var/run/nginx/nginx.pid"
nginx error log file:"/var/nginx/error.log"
nginx http access log file:"/var/log/nginx/access.log"
nginx http client request body temporaryfiles: "/var/tmp/nginx/client"
nginx http proxy temporary files:"proxy_temp"
nginx http fastcgi temporary files:"fastcgi_temp"
编译完成以后使用命令:
make $$ make install
进行配置安装。
3.2:yum 安装
4:nginx的配置文件:
- nginx简介与安装配置
- Nginx下载简介安装与配置
- Nginx简介与安装
- nginx安装与简介
- Nginx简介与安装
- Nginx简介与安装
- Nginx安装及配置简介
- Nginx安装及配置简介
- nginx安装与配置
- Nginx安装与配置
- nginx安装与配置
- Nginx 安装与配置
- nginx 安装与配置
- 【安装与配置】--Nginx
- Nginx 安装 与 配置
- nginx安装与配置
- 安装与配置nginx
- nginx安装与配置
- 一对多关系下取得特定关联一对一记录
- L2-008 最长对称子串
- 设计模式(2):工厂方法模式(Factory Method Pattern)
- 两种常见的UITabBarController+UINavigationController模式
- sql server2012设置用户登陆名字及密码
- nginx简介与安装配置
- python格式化输出
- L1-006. 连续因子
- 第二道算法题
- python调用c/c++
- Android 初学者必学ListView
- 数字系统中的亚稳态及其解决办法
- SpringBoot-从入门到放弃(二) 开发环境的搭建
- c语言排序