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 ...
随机推荐
- JSP九大内置对象(转载)
JSP中一共预先定义了9个这样的对象,分别为:request.response.session.application.out.pagecontext.config.page.exception 1. ...
- OpenJudge/Poj 1088 滑雪
1.链接地址: bailian.openjudge.cn/practice/1088 http://poj.org/problem?id=1088 2.题目: 总Time Limit: 1000ms ...
- Oracle 关于定义约束 / 修改表结构 /修改约束
---约束分5种:主键 外键 唯一 非空 检查5类约束 Oracle中分列级别约束 与 表级别约束 列级别约束:在创建表时再列上面加约束 例如: create table table11( stuno ...
- tomcat错误信息解决方案 严重:StandardServer.await:
看到这个报错我的第一反应就是端口被占用,用netstat -ant命令查看发现8080端口没有被占用,也可以看到 tomcat的进程已经存在,但是不能对外提供服务. 1.独立运行的tomcat.exe ...
- Asp.Net细节性问题精萃
1.<%=…%>与<%#… %>的区别: 答:<%=…%>是在程序执行时调用,<%#… %>是在DataBind()方法之后被调用 2.控件接收哪些类型 ...
- JS 日期格式转换
//Json 数据年月日 返回 直接传入参数 如/Date(1379433600000)/ function GetDate(date) { if (date == null) return null ...
- html+ashx 缓存问题
最近采用html+ashx的方式做了一个项目的几个配置页面的功能,由于浏览器的缓存问题,每次更新数据提交后,页面总是不会刷新,也就是说除了第一次加载页面会向一般处理(ashx)拿数据外,其他情况都是优 ...
- javascripct数组
定义数组 数组对象用来在单独的变量名中存储一系列的值. 我们使用关键词 new 来创建数组对象.下面的代码定义了一个名为 myArray 的数组对象: var myArray=new Array() ...
- opengl雾开启
#include <GL/glut.h> #include <stdio.h> #include <iostream> using namespace std; s ...
- sublime text 2 前端编码神器-快捷键与使用技巧介绍
介绍网址:http://www.xuanfengge.com/sublime-text-2-artifact.html