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: eventshttp,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

Linux学习笔记:nginx基础的更多相关文章

  1. Linux学习笔记之——基础命令学习

    1.find 按照名字查找:find / -name file_name   2.zip压缩 1) 我想把一个文件repartition.txt和一个目录invader压缩成为amateur.zip: ...

  2. linux/linux学习笔记-Shell基础(mooc)

    一.shell概述 shell根据ascII表,将命令翻译为0101...传给内核执行. 内核->shell翻译为命令->用户(操作的界面就是shell,shell=翻译官) linux标 ...

  3. Linux 学习笔记之超详细基础linux命令(the end)

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 14---------------- ...

  4. Linux 学习笔记之超详细基础linux命令 Part 14

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 13---------------- ...

  5. Linux 学习笔记之超详细基础linux命令 Part 13

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 12---------------- ...

  6. Linux 学习笔记之超详细基础linux命令 Part 12

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 11---------------- ...

  7. Linux 学习笔记之超详细基础linux命令 Part 11

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 10---------------- ...

  8. Linux 学习笔记之超详细基础linux命令 Part 10

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 9----------------- ...

  9. Linux 学习笔记之超详细基础linux命令 Part 9

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 8----------------- ...

  10. Linux 学习笔记之超详细基础linux命令 Part 8

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 7----------------- ...

随机推荐

  1. Open SuSE虚拟机分辨率不能自适应的解决办法

    装了一个比较老版本的open SuSE(12.3),即使编译安装VMtools之后分辨率依然不能自适应. 解决办法是手工运行下vmware-user-suid-wrapper这个命令即可解决.而且运行 ...

  2. 软件测试day1

    Windows基础 一.什么是软件(software) 计算机(computer)=硬件(hardware)+软件(software) 软  件(software)=程序(program)+文档(do ...

  3. js 字符串截取函数substr,substring,slice之间的差异

    js 字符串的截取,主要有三个函数,一般使用三个函数:substr,substring,slice. 而这三个函数是不完全一样的,平时很难记住,在这里做下笔记,下次遇到的时候,直接从这里参考,调用合适 ...

  4. 模拟PLC 的圆弧插补方式在VC中绘制圆弧

    最近同事想让要做一个绘图的控件.VC里面的画弧函数Arc需要提供外接矩形的坐标.同事觉得不好用,他更习惯圆弧插补的那种方式.于是看了看圆弧插补的东西.其实这种画弧方式就是提供圆弧的起点.终点和半径来画 ...

  5. Calico搭建配置

    Calico 是一个纯三层的协议,为 OpenStack 虚机和 Docker 容器提供多主机间通信.Calico 不使用重叠网络比如 flannel 和 libnetwork 重叠网络驱动, Cal ...

  6. 注意UTF-8-BOM 这个编码格式

    有时候文本文件处理出现异常,找不到其他原因的时候,注意查看下文件的编码: Notepad:编码菜单 如果发现是UTF-8-BOM,需要改成UTF-8

  7. cron表达式学习

    一.Cron 是计划任务(定时任务) 二.Cron表达式 Cron表达式是一个字符串,分为6或7个域,每个域用空格分开.Cron有如下两种语法格式: (1) Seconds Minutes Hours ...

  8. python的车牌号的检测

    自己总结一下,从网上找到的关于车牌号的识别的一些博文.https://www.jianshu.com/p/fcfbd3131b84 https://www.cnblogs.com/do-hardwor ...

  9. 基于django的博客系统

    这是前段代码 达到的效果并不是太好,但我还是要发出来,有更好的建议可以和我讨论 后台还算可以 添加了分类和文章两个功能,还在优化,敬请期待....

  10. Jmeter固定定时器(Constant Timer)

    如上图,Constant Timer是jmeter固定定时器元件 一般用来设置延时的,放在某个请求下,表示Constant Timer配置的指定时间后,再开始发起这个请求操作(单位:毫秒) 根据Con ...