nginx分发请求的2种方式:1、指明server_name;2、通过location过滤uri来分发请求;
user nginx;
worker_processes 8; # = cpu num; error_log /data/nginx/log/error/error.log warn; # warn, error crit, alert, and emerg levels are logged. NGINX Docs | Configuring Logging https://docs.nginx.com/nginx/admin-guide/monitoring/logging/ #pid logs/nginx.pid; events {
worker_connections 10240;
multi_accept on;
use epoll;
} http {
# log NGINX Docs | Configuring Logging https://docs.nginx.com/nginx/admin-guide/monitoring/logging/
log_format compression '$http_host - $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
gzip on;
access_log /data/nginx/log/access/nginx-access.log compression; include mime.types;
default_type application/octet-stream; server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
reset_timedout_connection on;
send_timeout 10;
limit_conn_zone $binary_remote_addr zone=addr:5m;
limit_conn addr 100;
charset UTF-8; open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
client_max_body_size 151M; server {
listen 80;
location ~ ^/visit/index?.+$ {
proxy_pass http://1.2.19.19:18080;
access_log /data/nginx/log/access/nginx-access-proxy_pass.log compression;
}
}
# 分发请求的2种方式:1、指明server_name;2、通过location过滤uri来分发请求;
server {
listen 80;
server_name localhost; #charset koi8-r;
#access_log logs/host.access.log main; root /var/www/statistics_20170105/public; location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; }
}
server {
listen 80;
server_name per.go-old.com; #charset koi8-r;
#access_log logs/host.access.log main; root /var/www/opcenter/public; location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; }
}
server {
listen 80;
server_name yzt.go-old.com pay.go-old.com xmt.go-old.com; #charset koi8-r;
#access_log logs/host.access.log main; root /var/www/yzt/public; location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; }
}
}
nginx分发请求的2种方式:1、指明server_name;2、通过location过滤uri来分发请求;的更多相关文章
- Zabbix监控nginx性能的另外一种方式
Zabbix监控nginx性能的另外一种方式 nginx和php-fpm一样内建了一个状态页,对于想了解nginx的状态以及监控nginx非常有用,为了后续的zabbix监控,我们需要先启用nginx ...
- 第二节:SSL证书的申请、配置(IIS通用)及跳转Https请求的两种方式
一. 相关概念介绍 1. SSL证书服务 SSL证书服务由"服务商"联合多家国内外数字证书管理和颁发的权威机构.在xx云平台上直接提供的服务器数字证书.您可以在阿里云.腾讯云等平台 ...
- C#中Post请求的两种方式发送参数链和Body的
POST请求 有两种方式 一种是组装key=value这种参数对的方式 一种是直接把一个字符串发送过去 作为body的方式 我们在postman中可以看到 sfdsafd sdfsdfds publi ...
- Spring MVC中forward请求转发2种方式(带参数)
Spring MVC中forward请求转发2种方式(带参数) http://www.51gjie.com/javaweb/956.html
- 解决 SharePoint 2010 拒绝访问爬网内容源错误的小技巧(禁用环回请求的两种方式)
这里有一条解决在SharePoint 2010搜索爬网时遇到的“拒绝访问错误”的小技巧. 首先要检查默认内容访问帐户是否具有相应的访问权限,或者添加一条相应的爬网规则.如果目标资源库是一个ShareP ...
- nginx负载均衡(5种方式)、rewrite重写规则及多server反代配置梳理
Nginx除了可以用作web服务器外,他还可以用来做高性能的反向代理服务器,它能提供稳定高效的负载均衡解决方案.nginx可以用轮询.IP哈希.URL哈希等方式调度后端服务器,同时也能提供健康检查功能 ...
- (转)nginx负载均衡(5种方式)、rewrite重写规则及多server反代配置梳理
Nginx除了可以用作web服务器外,他还可以用来做高性能的反向代理服务器,它能提供稳定高效的负载均衡解决方案.nginx可以用轮询.IP哈希.URL哈希等方式调度后端服务器,同时也能提供健康检查功能 ...
- nginx负载均衡的五种方式
文章目录 前言 :负载均衡是什么 一.方式1:轮询 二.方式2:权重 方式3:iphash 方式4:最小连接 方式5:fair 总结:根据这几种方式可以猜测处nginx的底层使用了计数器,从而可以将海 ...
- WebAPI GET和POST请求的几种方式
GET请求 1.无参数get请求 一般get请求有两种写法,一种是$.get() 一种是$.ajax({type:"get"}),我个人比较喜欢用后者. 下面例子主要是get无 ...
随机推荐
- Java线程停止interrupt()方法
程序是很简易的.然而,在编程人员面前,多线程呈现出了一组新的难题,如果没有被恰当的解决,将导致意外的行为以及细微的.难以发现的错误.在本篇文章中,我们针对这些难题之一:如何中断一个正在运行的线程. 中 ...
- 02、Windows Phone 套接字(Socket)实战之服务器端设计
这里主要写 PC 服务器端的逻辑,UI 使用的是 WPF,因为 WPF 比普通的 WinForm 的流式布局 更容易控制,而且比 WinForm 美观一些,显示截图: 一.页面 UI MainWind ...
- imooc 生鲜超市笔记
1.启动前端项目(Vue.js) cnpm run dev
- STM32CubeMX使用方法及功能介绍
推荐 分享一个朋友的人工智能教程,零基础!通俗易懂!希望你也加入到人工智能的队伍中来! http://www.captainbed.net/strongerhuang Ⅰ.写在前面 学习本文之前可以查 ...
- openresty package.path require 报错
在文件中 package.path = '/usr/local/share/lua/5.1/?.lua;/usr/local/openresty/lualib/resty/?.lua;' packag ...
- 树形dp - Codeforces Round #322 (Div. 2) F Zublicanes and Mumocrates
Zublicanes and Mumocrates Problem's Link Mean: 给定一个无向图,需要把这个图分成两部分,使得两部分中边数为1的结点数量相等,最少需要去掉多少条边. ana ...
- /sys/kernel/debug/gpio
在使用GPIO的时候,有时候不知道GPIO的状态,也不知道在内核中GPIO是否申请成功. 可以通过/sys/kernel/debug/gpio这个文件来查看.这个文件显示了申请成功的GPIO的输入输出 ...
- python爬虫<urlopen error [Errno 10061] >
在网上看了十几篇文章,都是说的是IE的代理设置,具体是: Tools->Internet Options->Connections->Lan Settings 将代理服务器的小勾勾去 ...
- jQuery对象与javaScript对象的互换
1. jQuery对象-->Dom对象 1) 通过 .[0] 的方式: var $s = $(.class); (jQuery对象) var s = $s.[0]; ...
- python XlsxWriter Example: Hello World
http://xlsxwriter.readthedocs.io/example_hello_world.html The simplest possible spreadsheet. This is ...