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. python 反射 hasattr getattr

    class BlackMedium:     feature='Ugly'     def __init__(self,name,addr):         self.name=name       ...

  2. win10基础上安装linux系统,添加双系统启动项

    1. 本机安装Centos7mini(注意点:进入安装界面先修改下面的内容,修改为U盘名称) 2. 配置文件/boot/grub2/grub.cfg,完成双系统启动设置. 3. 配置ip地址 nmcl ...

  3. HTML5 动画用 animation transform transition 做的两个例子

    1,左右移动,自我翻转的圆 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

  4. 批处理BAT运行不显示DOS窗口的方法

    新建记事本,写入下面内容 set ws=wscript.createobject("wscript.shell") ws.run "D:\scripts\svn-upda ...

  5. 小白安装openvas总结-原创20181213

    先对该工具进行熟悉: OpenVAS 介绍 1.关于OpenVAS OpenVAS(Open Vulnerability Assessment System)是一套开源的漏洞扫描系统,早期Nessus ...

  6. MySQL 权限相关

    # ============================= mysql 权限相关 =====================================================gran ...

  7. 基于Ubuntu的ESP32平台搭建

    提要:针对于Ubuntu下的ESP32搭建,网上有很多博文,乐鑫官网也有指导手册,对于到家都知道的部分我就一带而过,我主要描述搭建过程中遇到的问题和细节. 1.创建一个ESP的目录 I)在家目录下创建 ...

  8. 有关于并发中的死锁(Deadlock)、饥饿(Starvation)、活锁(Livelock)

    最近在看<实战Java高并发程序设计>,发现了之前没有接触过的几个名词. 死锁:之前在接触多线程的时候,接触过死锁的情况.死锁是线程中最糟糕的情况,如下面的图中的四辆车子一样,如果没有一辆 ...

  9. Jenkins安装和配置

     一.Jenkins的安装 我们在进行自动化测试的时候通常我们都会进行持续集成,可以帮助我们持续集成的工具有很多,我个人比较喜欢用Jenkins. 主要是因为它有如下优点: 开源免费 跨平台,支持所有 ...

  10. linux下压力测试工具ab的使用

    一.安装 [root@node2 logs]# yum install httpd-tools 已加载插件:fastestmirror Loading mirror speeds from cache ...