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----------------- ...
随机推荐
- C++使用指针的优点
使用指针可以带来如下的好处: (1)可以提高程序的编译效率和执行速度,使程序更加简洁. (2)通过指针被调用函数可以向调用函数处返回除正常的返回值之外的其他数据,从而实现两者间的双向通信. (3)利用 ...
- dojo里添加目录树
其实循环生成目录树这个方法不仅仅局限于在使用dojo的情况下,只要明白了其中的原理,在任何一种语言下都能动态循环生成. 1. 数据结构 在这里先说明一下数据结构,我这里循环生成目录树的数据结构是像这样 ...
- DLL 函数中使用结构体指针作函数参数(C# 调用 C++ 的 DLL)
存在的问题: 问题1:C++ 与 C# 同样定义的结构体在内存布局上有时并不一致: 问题2:C# 中引入了垃圾自动回收机制,其垃圾回收器可能会重新定位指针所指向的结构体变量. 解决方案: 问题1方案: ...
- Axis2 服务器端抛出ServiceClass object does not implement问题解决方法
在用eclipse配合Axis2进行开发的时候,编译通过,启动tomcat也顺利,但是就是在调用服务器端的服务时,会抛出: The ServiceClass object does not imple ...
- Fiddler手机抓包设置
前提条件:1).电脑需要安装Fiddler2).测试手机需要支持Wifi3).测试手机与电脑需要同一网络4).所测APP需支持代理 三.设置Fiddler 1.(1)电脑端打开安装好的的fiddler ...
- 拾遗----javascript一些实用方法
1. join() join() 方法用于把数组中的所有元素放入一个字符串.元素是通过指定的分隔符进行分隔的. var ids = []; for(var i = 0 ...
- Selenium分布式自动化测试平台 Standalone Server 4.0 搭建
最新的selenium测试平台大概有这么几个组件 Selenium Standalone Server: 用来搭建远程测试平台以及分布式测试. Selenium WebDriver: 最基础的用来创建 ...
- 关于新版oracle不支持wm_concat函数的解决办法
oracle12G中不支持wm_concat,就改用:listagg(合并字段,'连接符号') within group (order by 字段) 来实现列转行
- 《Go程序设计语言》读书笔记-函数
函数包含连续执行的语句,可以使用代码中通过调用函数来执行他们,函数能够将一个复杂的工作切分成多个更小的模块,使多人写作变得容易.另外,函数对他的使用者隐藏了实现细节.这几方面的特性使得函数成为多数编程 ...
- ASP.NET结合Redis实现分布式缓存
最近一个项目ASP.NET+MySQL 有的网页打开初始化的查询需要10秒甚至更久,用户体验极差,而且并发量变大的时候网站容易崩溃 后来想了两种解决方案都不是太满意 1.数据库里建一张缓存表,后台作业 ...