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无 ...
随机推荐
- python学习笔记(9)--Python UnicodeEncodeError: 'gbk' codec can't encode character 解决方法
Python UnicodeEncodeError: 'gbk' codec can't encode character 解决方法 这篇文章主要介绍了Python UnicodeEncodeErro ...
- Linux 新增一个用户命令 adduser
这几天新增用户老是会用 useradd , 这条命令比较复杂,记录 adduser 这条超级简单的命令. Full name 最后和用户差不多,不然登录的时候不好辨别 附: 新增用户无法 sudo 请 ...
- Java反射机制在工厂模式中的应用
在本篇文章中就不详细介绍工厂模式,主要介绍一下反射在工厂模式中的使用,让读者对反射机制带来的好处有更深的认识. 首先看一下简单工厂模式 简单工厂模式(simple factory)是类的创建模式,又叫 ...
- inline-block元素的空白间距解决方法<转>
使用inline-block来代替float进行布局,或者使用inline-block来实现元素的居中效果.有关于使用inline-block来代替float的讨论也蛮多的. 不过就是使用inline ...
- Linux系统查看公网IP地址
curl members.3322.org/dyndns/getip
- easy UI动态赋值
1,首先怎么清除这个值 $('#filegrid').datagrid('loadData', { total: 0, rows: [] }); 2,清除后,通过post提交请求,怎么将新植穿进去,这 ...
- PCB标识说明
VDC (Voltage Direct Current),直流电压 VBAT,电池供电 PWKEY,电源键 RXD,数据接收 TXD,数据发送 Receive Data ,Transmit Data ...
- 【BZOJ】1668: [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富(dp)
http://www.lydsy.com/JudgeOnline/problem.php?id=1668 裸dp.. f[i][j]表示i行j列最大能拿到 f[i][j]=max(f[i+1][j-1 ...
- CSS3文字立体效果
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...
- 用iis虚拟目录和windows共享目录上传文件到远程
现在有这样一个需求,有主机A和主机B.主机A上发布了一个网站,现在往主机A上上传文件默认是存在主机A上的, 如何把文件传到主机B上呢? 第一步在主机A和主机B上都创建同一个帐号admin,密码admi ...