user root root;
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
use epoll;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

#服务器的集群
upstream mySite.com { #服务器集群名字
#ip_hash;
#web服务器1
server 10.30.x.9:80 weight=10;
#web服务器2
#server 10.30.x.38:80 weight=10;
#server 114.119.x.191:10051 weight=5;#服务器配置 weight是权重的意思,权重越大,分配的概率越大。
#server 114.119.x.191:10057 weight=1;
}

server {
listen 80;
server_name yq.400085131x.com;
#server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
proxy_pass http://mySite.com;
#以下配置用于获取真实IP
proxy_set_header Host $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#关闭缓存
#add_header Cache-Control 'no-store';
}

#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;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}

# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

Nginx配置实际案例的更多相关文章

  1. nigin配置安全:三个案例看Nginx配置安全(转)

    转:https://www.leavesongs.com/PENETRATION/nginx-insecure-configuration.html 三个案例看Nginx配置安全 PHITHON  之 ...

  2. [Nginx] Nginx 配置location总结

    cp from : https://www.cnblogs.com/coder-yoyo/p/6346595.html location匹配顺序 "="前缀指令匹配,如果匹配成功, ...

  3. nginx配置文件结构,语法,配置命令解释

    摘要: nginx的配置文件类似于一门优雅的编程语言,弄懂了它的规范就可以自定义配置文件了,这个很重要~ 1,结构分析 nginx配置文件中主要包括六块:main,events,http,server ...

  4. nginx配置location总结

    location匹配顺序 "="前缀指令匹配,如果匹配成功,则停止其他匹配 普通字符串指令匹配,顺序是从长到短,匹配成功的location如果使用^~,则停止其他匹配(正则匹配) ...

  5. 原创|强大!Nginx 配置在线一键生成“神器”

    Nginx作为一个轻量级的HTTP服务器,相比Apache优势也是比较明显的,在性能上它占用资源少,能支持更高更多的并发连接,从而达到提高访问效率;在功能上它是一款非常优秀的代理服务器与负载均衡服务器 ...

  6. nginx配置神器

    原文 https://mp.weixin.qq.com/s/zFEk7XzHj3xPReDXEnQxcQ https://nginxconfig.io/ Nginx作为一个轻量级的HTTP服务器,相比 ...

  7. Tomcat+Nginx+Memcached综合案例

    Tomcat+Nginx+Memcached综合案例 说明 通过Nginx解析静态页面并将动态负载均衡调度给后面的多个Tomcat,Tomcat解析java动态程序. 由于http是无状态的协议,你访 ...

  8. Nginx配置各种响应头防止XSS,点击劫持,frame恶意攻击

    为什么要配置HTTP响应头? 不知道各位有没有被各类XSS攻击.点击劫持 (ClickJacking. frame 恶意引用等等方式骚扰过,百度联盟被封就有这些攻击的功劳在里面.为此一直都在搜寻相关防 ...

  9. 【Nginx(三)】Nginx配置集群 负载均衡策略

    Nginx配置集群 负载均衡策略 一.安装环境 1.安装JDK8的环境,配置JDK8的环境变量 2.上传jar包demo-1.jar 和 demo-2.jar demo-1.jar 监听8080端口; ...

随机推荐

  1. Python_str 的内部功能介绍

    float: x.as_integer_ratio():把浮点型转换成分数最简比 x.hex():返回当前值的十六进制表示 x.fromhex():将十六进制字符串转换为浮点型 float与long的 ...

  2. 基于Kubernetes集群部署skyDNS服务

    目录贴:Kubernetes学习系列 在之前几篇文章的基础,(Centos7部署Kubernetes集群.基于kubernetes集群部署DashBoard.为Kubernetes集群部署本地镜像仓库 ...

  3. BZOJ3675 [Apio2014]序列分割 动态规划 斜率优化

    原文链接http://www.cnblogs.com/zhouzhendong/p/8697258.html 题目传送门 - BZOJ3675 题意 对于一个非负整数序列,小H需要重复k次以下的步骤: ...

  4. 查找常用字符(给定仅有小写字母组成的字符串数组 A,返回列表中的每个字符串中都显示的全部字符(包括重复字符)组成的列表。例如,如果一个字符在每个字符串中出现 3 次,但不是 4 次,则需要在最终答案中包含该字符 3 次。)

    给定仅有小写字母组成的字符串数组 A,返回列表中的每个字符串中都显示的全部字符(包括重复字符)组成的列表. 例如,如果一个字符在每个字符串中出现 3 次,但不是 4 次,则需要在最终答案中包含该字符 ...

  5. Sleep,Hibernate and Hybrid

    Sleep is a power-saving state that allows a computer to quickly resume full-power operation (typical ...

  6. ECMAScript 原始类型

    ---恢复内容开始--- ECMAScript 有 5 种原始类型(primitive type),即 Undefined.Null.Boolean.Number 和 String. 1.typeof ...

  7. httpd的rpm包及源码安装配置

    httpd的rpm包及源码安装配置 1.rpm包安装 系统环境: [root@zhaochj ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel ...

  8. Google Hack搜索技巧

    想了解更多搜索技巧,点击下面网站了解http://exploit-db.com/google-dorks Google Hack的一些整理 这里是google关键字的用法,要设置它为中文,则是 htt ...

  9. DNS信息收集工具dig使用

    Dig是域信息搜索器的简称(Domain Information Groper),使用dig命令可以执行查询域名相关的任务 常见域名记录: A(主机记录 把一个域名解析成IP地址) C name(别名 ...

  10. ECMAScript6 入门 变量的解析赋值

    ES6 允许按照一定模式,先=从数组和对象中提取值,对变量进行赋值,这被称为解构(Destructuring). 这句话的解释:第一步从数组或者对象中提取值,第二步将提取到的值对变量进行赋值 数组的解 ...