Nginx (a) Introduction

Nginx Profile

一款基于异步框架的轻量级高性能的Web 服务器/反向代理服务器/缓存服务器/电子邮件(IMAP/POP3)代理服务器

Feature

高并发量:基于 epoll/kqueue 模型开发,支持高并发量,官方说其支持高达 5w 并发连接数的响应
内存消耗少:善于处理静态文件,相较于其他web(比如:apache),占用更少的内存及资源
简单稳定:配置简单(一个conf文件),运行简单(nginx命令),而且运行稳定
模块化程度高:功能模块插件化设计,可以自由配置相应的功能。
支持Rwrite重写规则:能够根据域名、URL等请求关键点,实现定制化的高质量分发。
低成本:Nginx的负载均衡功能很强大而且免费开源,相较于几十万的硬件负载均衡器成本相当低。
支持多系统:Nginx代码完全用C语言从头写成,可以在各系统上编译并使用。

Shortcoming

动态处理差:nginx善于处理静态文件,但是处理动态页面相较于Apache之类重量级的web软件能力稍欠缺。
rewrite弱:虽然nginx支持rewrite功能多,但是相较于Apache之类重量级的web软件能力稍欠缺。

Nginx installation

ubuntu
apt install nginx -y

CentOs

yum install nginx -y

MacOs

brew install nginx
Nginx service will automatically open after the installation is complete, the port 80

nginx command

nginx -v : 查看 nginx版本
nginx : 启动 nginx服务
nginx -s stop : 停止 nginx服务
nginx -t : 检查默认配置文件
nginx -t -c filename.conf : 检查指定的配置文件
nginx -s reload : 重启nginx,重启前会自动检查默认配置

Nginx Contents Introduction

工作目录:/etc/nginx
执行文件: /usr/sbin/nginx
日志目录:/var/log/nginx
启动文件:/etc/init.d/nginx
web目录:/var/www/html/,首页文件是index.nginx-debian.html
 /usr/share/nginx/html/ 首页文件是index.html

Nginx configuration profile:

默认文件:
/etc/nginx/nginx.conf
其他目录:
/etc/nginx/{sites-available/sites-enabled/conf.d}
文件结构:
        全局配置段
        http配置段
            server配置段       :   项目或者应用
                location配置段 :   url配置``

Guess you like

Origin www.cnblogs.com/snailrunning/p/12105077.html