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 ...
随机推荐
- 牛客网算法题之All-in-All
题目: 有两个字符串s 和t,如果即从s 中删除一些字符,将剩余的字符连接起来,即可获得t.则称t是s 的子序列.请你开发一个程序,判断t是否是s的子序列. 输入描述: 输入包含多组数据,每组数据包含 ...
- Ant 入门
参考: Ant官网 http://ant.apache.org/ 轻量级java ee企业应用实战(李刚) Ant当前版本1.9.6 Ant基于Java 配置环境变 ...
- 九度OJ 1163 素数
题目地址:http://ac.jobdu.com/problem.php?pid=1163 题目描述: 输入一个整数n(2<=n<=10000),要求输出所有从1到这个整数之间(不包括1和 ...
- spring常用的连接池属性文件配置
(一) DBCP 引入jar文件 commons-dbcp-1.2.1.jar commons-pool-1.3.jar二个包. spring配置文件 <bean id="dataSo ...
- 栈(顺序存储)C++模板实现
#include <iostream> using namespace std; template <typename T> class stack{ private: int ...
- call_user_func_array
call_user_func_array — 调用回调函数,并把一个数组参数作为回调函数的参数 参数 callback 被调用的回调函数. param_arr 要被传入回调函数的数组,这个数组得是索引 ...
- 在Intellij IDEA或者PhpStorm下用X-debug调试PHP
用Intellij IDEA或者PhpStorm使用X-debug来调试PHP,主要需要配置的部分有三个地方,分别为php.ini的配置,IDEA的配置和浏览器的配置,主要如下,以备忘: php.in ...
- Oracle 事务相关的一些测试
1.sqlplus 客户端正常退出 SQL> desc t; 名称 是否为空? 类型 ----------------------------------------- -------- --- ...
- Pair Project: Elevator Scheduler [电梯调度算法的实现和测试]:刘耀先-11061183,罗凡-11061174
本次为我们两个人的第一次结对编程.从总体而言,我们对结对编程比单人编程略显不适应.但是经过一段时间的磨合,我们逐渐的习惯了这种编程方式. 1. 结对编程的优缺点 结对编程的优点: (1) ...
- js格式化数字 金额按千位逗号分隔
// 返回数字 function removeFormatMoney(s) { return parseFloat(s.replace(/[^\d\.-]/g, "")); } / ...