一:Nginx命令

1、-v : 打印版本号
[root@web01 ~]# nginx -v
nginx version: nginx/1.20.2 2、-V : 打印版本号和配置项(模块)
[root@web01 ~]# nginx -V
nginx version: nginx/1.20.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx 3、-t : 检查配置文件
[root@web01 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful 4、-T : 测试配置文件并启动 5、-q :打印错误日志 6、-s : 操作进程
stop :停止
quit :退出
reopen :重启
reload :重载
7、-p : 指定nginx的工作目录
8、-e : 指定错误日志路径
9、-c : 指定配置文件的路径
10、-g : 设置一个全局的Nginx配置项(容器用到)
[root@web01 ~]# systemctl stop nginx
[root@web01 ~]# nginx -g 'daemon off;'

二:Nginx全局配置文件

1.nginx全局配置
vim /etc/nginx/nginx.conf

2.过滤出Nginx
ps -ef | grep nginx			: 过滤

1、全局配置
1、user : 指定Nginx的启动用户
2、worker_processes : 定义Nginx的worker进程数
worker内默认有一个auto auto === CPU数量

3、error_log : 错误日志路径
4、pid : pid的存放文件路径
5、events : 模块配置
5.1、worker_connections :每一个worker进程最多同时接入多少个请求
(1个进程可以处理1024个请求)
5.2、use : 指定Nginx的网络模型(epol)
6、http : web服务的模块
6.1、include : 加载外部的配置项
6.2、default_type : 如果找不到文件的类型,则按照指定默认类型处理
6.3、log_format : 定义日志格式
log_format json '{"@timestamp":"$time_iso8601",'
'"host":"$server_addr",'
'"service":"nginxTest",'
'"trace":"$upstream_http_ctx_transaction_id",'
'"log":"log",'
'"clientip":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"http_user_agent":"$http_user_agent",'
'"size":$body_bytes_sent,'
'"responsetime":$request_time,'
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",'
'"url":"$uri",'
'"domain":"$host",'
'"xff":"$http_x_forwarded_for",'
'"referer":"$http_referer",'
'"status":"$status"}';
access_log /var/log/nginx/access.log json ;
6.4、sendfile : 高效读取文件
6.5、keepalive_timeout : 长连接保持连接的
HTTP 1.0 短链接
HTTP 1.1 长连接 6.55(以下编辑配置文件尾部必须.conf 因<*.conf)
include /usr/share/nginx/modules/*.conf;

三:Nginx网址模块(解析)

vim /etc/nginx/conf.d/game.conf
		server : 网址模块
listen : 监听的端口
server_name : 定义域名
location : 访问路径
root : 指定网址路径
index : 指定网址的索引文件

最新文章

  1. css高级
  2. 写了一个基于React+Redux的仿Github进度条
  3. Node异步
  4. python操作Excel读写--使用xlrd和xlwt
  5. ACDream-C - Transformers&#39; Mission(Dijastra最短路径)
  6. oracle插入主键数据、sequence和触发器
  7. JS判断手机浏览器
  8. linux shell if 参数
  9. portal---easyui
  10. IOS的KVC
  11. JAVASCRIPT 调用 OCX 的那些坑
  12. 如何把kotlin+spring boot开发的项目部署在tomcat上
  13. TeamCity 创建jar构建步骤
  14. jQuery使用CDN加速
  15. EasyARM-iMX283A的make menuconfig出现错误:Install ncurses(ncurses-devel) and try again。
  16. what does GIT PUSH do exactly?
  17. MSSQL-SELECT&amp;UPDATE动作要申请的锁
  18. Features Download Pricing Mind Maps Blog XMind的快捷键
  19. OpenCV几种访问cv::Mat数据的方法
  20. P2837晚餐队列安排

热门文章

  1. Android Linux vmstat 命令详解
  2. 【LeetCode】453. Minimum Moves to Equal Array Elements 解题报告(Java & Python & C++)
  3. 【LeetCode】9. Palindrome Number 回文数
  4. 魔法串(hud4545)
  5. Loss Landscape Sightseeing with Multi-Point Optimization
  6. Vue.js高效前端开发知识 • 【目录】
  7. Hexo博客部署到腾讯云服务器全过程(Nginx,证书,HTTPS),你要的这里都有
  8. 使用tomcat搭建HTTP文件下载服务器
  9. SpringBoot 与 SpringCloud 的版本对应详细信息
  10. mysql数据库安装教程