Mater Nginx(2) - A Configuration Guide
由一个主配置文件和一些辅助配置文件构成,位于conf目录下
配置指令 指令参数(配置指令对应的值)
token串分为简单字符串或复合配置块({})
简单配置项 复杂配置项
error_page 500 502 /50x.html;
location / {
root /home/html;
index index.html index.htm
}
根据逻辑意义分成了多个作用域,即配置指令上下文
nginx支持的指令上下文,即作用域
main
http
server
location
指令上下文,可能有包含的情况出现。例如,通常http上下文和mail上下文一定是出现在main上下文里。
user nobody;
worker_processes 1;
error_log logs/error.log info;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name www.linuxdc.com;
}
}
The basic configuration format
Nginx global configuration parameters
Using include files
The HTTP server section
The virtual server section
Locations - where, when and how
The mail server section
Full sample configuration
Loadbalance
upstream web_backend {
server 10.11.12.51
server 10.11.12.52
}
server {
listen ;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://web_backend;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
Starting, Stopping, and Reloading Configuration
nginx -s stop --fast shutdown
nginx -s quit --graceful shutdown
nginx -s reload --reloading the config file
nginx -s reopen --reopening the log files kill -s QUIT
ps -ax | grep nginx
Serving Static Content
/data/www --index.html
/data/images --some images
http {
server {
location / {
root /data/www;
}
location /images/ {
root /data;
}
}
}
http://localhost/images/example.png -- /data/images/example.png
http://localhost/some/example.html -- /data/www/some/example.html
nginx -s reload
Find out reason in access.log or error.log, in the directory of /usr/local/nginx/logs or /var/log/nginx
Setting Up a Simple Proxy Server
http {
server {
location / {
proxy_pass http://localhost:8080;
}
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
}
Setting Up FastCGI Proxying
http {
server {
location / {
fastcgi_pass localhost:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
}
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
}
Mater Nginx(2) - A Configuration Guide的更多相关文章
- Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks
原文链接:http://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips- ...
- P6 EPPM Installation and Configuration Guide 16 R1 April 2016
P6 EPPM Installation and Configuration Guide 16 R1 April 2016 Contents About Installing and ...
- P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1
P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1 May ...
- Installation and Configuration Guide
Harbor can be installed by one of three approaches: Online installer: The installer downloads Harbor ...
- Ehcache(2.9.x) - Configuration Guide, Configuring Cache
About Ehcache Configuration Ehcache supports declarative configuration via an XML configuration file ...
- In-App Purchase Configuration Guide for iTunes Connect---(一)----Introduction
Introduction In-App Purchase is an Apple technology that allows your users to purchase content and s ...
- Nginx Installation、Configuration、Rreverse Proxy、Load Balancing Learning
目录 . Nginx简介 . Nginx安装部署 . Nginx安全配置 . Nginx反向代理实践 . Nginx负载均衡实践 1. Nginx简介 0x1: Nginx的基本特性 Nginx(&q ...
- Ehcache(2.9.x) - Configuration Guide, Configuring Storage Tiers
About Storage Tiers Ehcache has three storage tiers, summarized here: Memory store – Heap memory tha ...
- Openstack: Single node Installation and External Network Accessing Configuration Guide
Summary of installation Step 0: Prerequisites Step 1: Create Openstack hostsystem Step 2: Config Ope ...
随机推荐
- 删除Windows 文本右键选项
删除Windows 文本右键选项 在Windows上用所谓的绿色版安装了EditPlus,但是给的卸载程序(即删除掉注册表相应的选项)无法使用,导致只能手动从Regedit(注册表-编辑器)中手动删除 ...
- 暑假集训(2)第七弹 -----今年暑假不AC(hdu2037)
J - 今年暑假不AC Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64 ...
- Fire Net
Fire Net Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Subm ...
- Objective-C 之同步请求、异步请求、GET请求、POST请求
本篇文章由:http://www.sollyu.com/objective-c-synchronization-requests-requests-for-asynchronous-requests- ...
- poj 3565 uva 1411 Ants KM算法求最小权
由于涉及到实数,一定,一定不能直接等于,一定,一定加一个误差<0.00001,坑死了…… 有两种事物,不难想到用二分图.这里涉及到一个有趣的问题,这个二分图的完美匹配的最小权值和就是答案.为啥呢 ...
- 啊哈!算法:解密QQ号
书中给出的算法有点浪费空间,可以使用循环队列进行改进,这样就不需要使用额外的空间,在原数组的基础上就可以完成解密,代码如下: #include <stdio.h> void decode( ...
- javaweb——总结
day01XML上 1.XML的作用 2.XML的基本语法 3.DTD约束 4.DTD的基本语法(看懂DTD就ok) 5.XML的解析方式:原理 6.JAXP的DO ...
- BFC(Box,Formatting,Context) —— 块级格式化上下文
Box:CSS布局的基本单位 Formatting context是页面中的一块渲染区域,最常见的是BFC和IFC,CSS3增加了GFC和FFC BFC定义:块级格式化上下文,它是一个独立的渲染区域, ...
- 多行滚动jQuery循环新闻列表代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 基于C#的SolidWorks插件开发(2)--创建插件
在项目工程中可以看到SwAddin.cs文件.这个文件是插件的核心文件,包括插件的名称,注册表项,菜单,以及菜单的回调函数都在该文件中实现. 1.修改插件的名称和描述 Guid为插件生成后注册到注册表 ...