Nginx
1、基础概念
Nginx的定义
Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。
Nginx转为性能优化开发!
反向代理
正向代理:客户端(浏览器)配置代理服务器地址进行代理
反向代理
正向代理代理客户端,反向代理代理服务器
负载均衡
动静分离
把动态资源和静态资源分别用不同的服务器部署
2、安装使用
Linux安装
kali2020 中自带nginx
执行目录/usr/sbin/nginx
已添加进系统环境
配置文件目录/etc/nginx/
nginx.conf
常用命令
root@kali:/etc/nginx# nginx -h
nginx version: nginx/1.16.1
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/share/nginx/)
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file
# 查看nginx服务状态
root@kali:/var/www/html