Linux学习笔记:nginx基础
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
Linux学习笔记:nginx基础的更多相关文章
- Linux学习笔记之——基础命令学习
1.find 按照名字查找:find / -name file_name 2.zip压缩 1) 我想把一个文件repartition.txt和一个目录invader压缩成为amateur.zip: ...
- linux/linux学习笔记-Shell基础(mooc)
一.shell概述 shell根据ascII表,将命令翻译为0101...传给内核执行. 内核->shell翻译为命令->用户(操作的界面就是shell,shell=翻译官) linux标 ...
- Linux 学习笔记之超详细基础linux命令(the end)
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 14---------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 14
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 13---------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 13
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 12---------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 12
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 11---------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 11
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 10---------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 10
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 9----------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 9
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 8----------------- ...
- Linux 学习笔记之超详细基础linux命令 Part 8
Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 7----------------- ...
随机推荐
- 《深入理解java虚拟机》读书笔记——垃圾收集与内存分配策略
可回收判定两种算法 引用计数法(Reference Counting):引用为0时可回收. 可达性分析法(Reachability Analysis): 从GCRoots对象到这个对象不可达. GCR ...
- Jmeter学习记录
JSON正则表达式提取规则 https://www.cnblogs.com/hc1020/p/7723720.html Jmeter非GUI下执行日志 执行命令 ./jmeter -n -t $ ...
- Java数组操作十大方法 (转)
定义一个Java数组 String[] aArray = new String[5]; String[] bArray = {"a","b","c&q ...
- ---- 关于Android蓝牙搜索到设备的图标显示和设备过滤
根据: https://www.douban.com/note/637446089/http://bbs.16rd.com/blog-23795-3446.html 以下摘自原文: (Android主 ...
- web跨域问题(No 'Access-Control-Allow-Origin'..)
1. 问题 angular开发中连接java服务时出现跨域问题(No 'Access-Control-Allow-Origin'..). 如下图 解决方法 2,原因分析 这个与安全机制有关,默认情况下 ...
- 项目集成swagger【转载】
地址链接:https://blog.csdn.net/lx1309244704/article/details/81808788 swagger是一款高效易用的嵌入式文档插件,同时支持在线测试接口,快 ...
- python os.path.isfile函数
最近刚开始学习Python,做了个小练习:扫描当前目录及其子目录中的文件,找出文件名中含有指定关键字的文件并打印文件名.思路很简单,如果是文件则判断是否满足条件:如果是目录则进入目录搜索文件,递归. ...
- [TestNG] [WARN] Ignoring duplicate listener : org.testng.IDEATestNGRemoteListenerEx
1. 使用6.10,和6.14.3版本testng,出现多条warn信息 [TestNG] [WARN] Ignoring duplicate listener : org.testng.IDEATe ...
- winform窗体运行时的大小和设计时不一致
窗体设置的尺寸为1946*850,而电脑分辨率是1920*1280 按说宽度已经超过屏幕大小很多了,应该显示占满屏幕宽度才对,但是运行时宽度只有设计时的一半 高度最多只能是1946像素,再拉大也不管用 ...
- jQuery实现动态分割div
转自:https://www.cnblogs.com/herd/p/6014848.html 演示地址:http://www.vfkjsd.cn/div/2/div.html