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无 ...
随机推荐
- 深入理解Spark 2.1 Core (十一):Shuffle Reduce 端的原理与源代码分析
http://blog.csdn.net/u011239443/article/details/56843264 在<深入理解Spark 2.1 Core (九):迭代计算和Shuffle的原理 ...
- web压力测试指标
1.TPS每秒钟完成的web请求响应数量TPS=并发数/响应时间TPS是衡量系统性能的重要指标 2.并发数时间段内,系统同时处理的web请求响应数量 3.响应时间所有web请求处理完毕的时间 4.吞吐 ...
- 不同classloader装载的类不能互相访问?
一,有两个术语,一个叫“定义类加载器”,一个叫“初始类加载器”. 比如有如下的类加载器结构: bootstrap ExtClassloader AppClassloader -自定 ...
- 将多个文件夹内的txt合并
import os import re def text_create(name): """ 创建txt文件夹 """ desktop_pa ...
- am335x 一个按键实现重置 ip 和 root passwd
* 其实做法很简单,我连按键驱动都没有去写,读取 gpio 的值然后 拷贝了一份 /etc/network/interfaces_bak 为 interfaces ,用脚本重新设置了一次root 密码 ...
- linux -- camera shot 拍照功能
#include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> ...
- UCOS2系统内核讲述_总体描述
Ⅰ.写在前面 学习本文之前可以参考我前面基于STM32硬件平台移植UCOS2的几篇文章,我将其汇总在一起: UCOS2_STM32F1移植详细过程(汇总文章) 要想学习,或使用系统配套的资源(如:信号 ...
- eclipse启动无响应,老是加载不了revert resources,或停留在Loading workbench状态
做开发的同学们或多或少的都会遇到eclipse启动到一定程度时,就进入灰色无响应状态再也不动了.启动画面始终停留在Loading workbench状态.反复重启,状态依旧. 多数情况下,应该是非正常 ...
- 求逆元 - HNU 13412 Cookie Counter
Cookie Counter Problem's Link: http://acm.hnu.cn/online/?action=problem&type=show&id=13412&a ...
- 【BZOJ】1617: [Usaco2008 Mar]River Crossing渡河问题(dp)
http://www.lydsy.com/JudgeOnline/problem.php?id=1617 裸dp,很好做. 设f[i]表示i头牛到对岸所需最小时间.sum[i]表示运i头牛到对岸的时间 ...