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----------------- ...
随机推荐
- mysql导入excel表格
https://jingyan.baidu.com/album/fc07f9891cb56412ffe5199a.html?picindex=1
- Win7+ 电脑 休眠 自动唤醒
https://jingyan.baidu.com/article/3ea51489d905df52e71bba6b.html
- vue.js响应式原理解析与实现
vue.js响应式原理解析与实现 从很久之前就已经接触过了angularjs了,当时就已经了解到,angularjs是通过脏检查来实现数据监测以及页面更新渲染.之后,再接触了vue.js,当时也一度很 ...
- cdh启动datanode报错
问题: 为cdh新增节点时,在分配datanode后,启动报错 Can't open /iot/opt/cloudera-manager/cm-5.11.2/run/cloudera-scm-agen ...
- node读取文件转换json文件
{ ".323":"text/h323" , ".3gp":"video/3gpp" , ".aab" ...
- Grafana短信报警实现
1.阿里云短信服务API2.Jenkins-plugin:Generic Webhook Trigger Plugin 阿里云 下载阿里云短信服务SDK 创建短信服务ACCESS_KEY_ID Gra ...
- MySQL慢查询日志相关的文件配置和使用。
MySQL慢查询日志提供了超过指定时间阈值的查询信息,为性能优化提供了主要的参考依据,是一个非常实用的功能,MySQL慢查询日志的开启和配置非常简单,可以指定记录的文件(或者表),超过的时间阈值等就可 ...
- 基础算法简单实现-python
目录 Python(版本3.6+)-Anna-Lena Popkes
- java mybatis后台判断表是否存在mysql
<select id="isTableExist" parameterType="string" resultType="int"&g ...
- CSS 背景图像 填充整个页面示例
background-image 属性可以设置背景图像. 背景图像可以填充整个页面的,也可以填写一部分. background-image 属性的使用很简单:background-image:url( ...