nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.

nginx是一个http和反转代理服务器,还可以用作邮件代理,TCP/UDP代理服务器。

nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests. nginx employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores

Window平台下(如果linux下将nginx当成一个应用使用的话,用法和window平台下差不多,如果在linux系统上作为服务使用,则区别较大):

下载安装

window平台下,下载nginx-1.15.12的压缩包,解压即可。

使用

windows平台下,在解压目录下,启动命令

start nginx

启动tasklist命令行工具包来查看进程

tasklist /fi "imagename eq nginx.exe"

其他命令

nginx/Windows runs as a standard console application (not a service), and it can be managed using the following commands:

  • nginx -s stop         fast shutdown
  • nginx -s quit          graceful shutdown,This command should be executed under the same user that started nginx
  • nginx -s reload      changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
  • nginx -s reopen     re-opening log files

nginx的配置文件在 ./conf/nginx.conf 中,Configuration File文件的结构:

nginx consists of modules which are controlled by directives specified in the configuration file. Directives are divided into simple directives and block directives. A simple directive consists of the name and parameters separated by spaces and ends with a semicolon (;). A block directive has the same structure as a simple directive, but instead of the semicolon it ends with a set of additional instructions surrounded by braces ({ and }). If a block directive can have other directives inside braces, it is called a context (examples: events, http,server, and location).

Directives placed in the configuration file outside of any contexts are considered to be in the main context. The events and http directives reside in the main context, server in http, and location in server.

The rest of a line after the # sign is considered a comment.

Linux平台下(以Centos为例,此时nginx是作为一项服务):

安装

yum install epel-release

yum install nginx

服务的管理 开启 查询 停止 重启

systemctl start nginx

systemctl status nginx

systemctl stop nginx

systemctl restart nginx 

重新载入nginx的配置文件(在修改配置文件之后)

systemctl reload nginx

nginx的主要配置文件在 /etc/nginx

核心配置文件是 /etc/nginx/nginx.conf

日志文件是在 /var/log/nginx

上面都是直接使用安装包,如果对ngnix有较高的定制需求,需要自己编译打包,还可以下载丰富的第三方插件。

参考:

http://nginx.org/en/docs/beginners_guide.html

https://linuxize.com/post/how-to-install-nginx-on-centos-7/

End

转载于:https://www.cnblogs.com/colin220/p/10728798.html

Nginx学习笔记:基础相关推荐

  1. 【005】Nginx学习笔记-Nginx真实IP

    [005]Nginx学习笔记-Nginx真实IP 真实IP 客户端真实IP 深入理解真实IP 实验一 实验二: 多个代理服务器的情况 实验三:利用realip模块获取客户端真实IP 实验四:伪装请求头 ...

  2. 全是精髓!也许是最完美的“Nginx学习笔记”了,阿里云高工“365”天手写!

    前言 "Nginx",一个高性能的HTTP和反向代理web服务器,Nginx因为内存少.并发能力强的特性,深受虚拟机主机提供商的欢迎,可以支持高达50000个并发连接数的响应.Ng ...

  3. nginx 学习笔记(2) nginx新手入门

    这篇手册简单介绍了nginx,并提供了一些可以操作的简单的工作.前提是nginx已经被安装到你的服务器上.如果没有安装,请阅读上篇:nginx 学习笔记(1) nginx安装.这篇手册主要内容:1. ...

  4. Spring Boot学习笔记-基础(2)

    Spring Boot学习笔记-基础(2) Spring Boot 优点: – 快速创建独立运行的Spring项目以及与主流框架集成 – 使用嵌入式的Servlet容器,应用无需打成WAR包 – st ...

  5. nginx学习笔记-01nginx入门,环境搭建,常见命令

    nginx学习笔记-01nginx入门,环境搭建,常见命令 文章目录 nginx学习笔记-01nginx入门,环境搭建,常见命令 1.nginx的基本概念 2.nginx的安装,常用命令和配置文件 3 ...

  6. Nginx学习笔记3:Shell脚本检测Nginx服务状态

    前言 nginx 服务启动后,我们需要对其服务状态进行监控,今天学习过程中了解到一段非常有用的小脚本,不仅可以监控Nginx,也可以用来监控其他服务 脚本 A=`ps -C nginx –no-hea ...

  7. 《python基础教程(第二版)》学习笔记 基础部分(第1章)

    <python基础教程(第二版)>学习笔记 基础部分(第1章) python常用的IDE: Windows: IDLE(gui), Eclipse+PyDev; Python(comman ...

  8. MySQL学习笔记-基础篇1

    MySQL 学习笔记–基础篇1 目录 MySQL 学习笔记--基础篇1 1. 数据库概述与MySQL安装 1.1 数据库概述 1.1.1 为什么要使用数据库 1.2 数据库与数据库管理系统 1.2.1 ...

  9. Redis学习笔记①基础篇_Redis快速入门

    若文章内容或图片失效,请留言反馈.部分素材来自网络,若不小心影响到您的利益,请联系博主删除. 资料链接:https://pan.baidu.com/s/1189u6u4icQYHg_9_7ovWmA( ...

  10. c语言/c++转Java学习笔记---基础问题

    c语言/c++转Java学习笔记---基础问题 1.java注释 2.数组的定义和使用 定义 使用 3.类 4.this 的使用 5.继承 6.super的使用 7.包 8.修饰符 成员的访问控制符( ...

最新文章

  1. AI一分钟 | 北京开放自动驾驶车辆路测道路105公里;阿里将人工智能引入时尚界...
  2. 大数据落地决胜的关键——百分点BASIC模型
  3. python版mapreduce题目实现寻找共同好友
  4. 数据结构 -- 队列
  5. python 用途-python主要用途
  6. 怎么html中加样式,简明教程 在HTML中添加样式表的方法
  7. boost::type_erasure::equality_comparable相关的测试程序
  8. 如何自定义SAP Spartacus的路由路径
  9. tfs 未能在以下位置创建报表文件夹 /TfsReports: 授予的权限不足,无法执行此操作
  10. Lenovo ThinkPad 3999元型号发布 并不属于SL系列
  11. Java面向对象编程 第一章 面向对象开发方法概述
  12. java 单例基类_PHP基于单例模式实现的数据库操作基类
  13. 漫画 | 如果面试时大家都说真话…
  14. python mongodb查询速度优化_Mongodb 3 查询优化(语句优化、建索引)
  15. Android GIS开发系列-- 入门季(15) 网络图层加载
  16. java核心技术 下载 网盘_【资源分享】某宝买的40000GB游戏,有你想要的游戏哦,可单独保存或下载...
  17. 【webrtc 桌面采集】DXGI 流程
  18. 迪文屏学习系列之数据录入
  19. 使用超级表格快速创建在线表单(如问卷调查、报名表)
  20. 技术团队里什么样的人会被清除?抢老板的工作干合适吗?

热门文章

  1. django实现搜索功能
  2. python学习总结----异常处理
  3. BZOJ 4826: [Hnoi2017]影魔 单调栈 主席树
  4. spring security oauth2.0 实现
  5. 深度学习三十年创新路
  6. 乔治城计算机系如何,乔治城大学cs专业申请
  7. ubuntu E470无线网卡驱动
  8. building xxx gradle project info的解决办法
  9. linux 读写权限
  10. zabbix3.x添加H3C网络设备详解