user root root;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
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 ;
keepalive_timeout ; #gzip on; #服务器的集群
upstream mySite.com { #服务器集群名字
#ip_hash;
#web服务器1
server 10.30.x.x: weight=;
#web服务器2
#server 10.30.x.x: weight=;
#server 114.119.x.x: weight=;#服务器配置 weight是权重的意思,权重越大,分配的概率越大。
#server 114.119.x.x: weight=;
} server {
listen ;
server_name x.x.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 /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# 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 ;
# listen somename:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 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. Nginx配置实例-负载均衡实例:平均访问多台服务器

    场景 Nginx配置实例-反向代理实例:根据访问的路径跳转到不同端口的服务中: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10 ...

  2. Nginx配置实例-反向代理实例:根据访问的路径跳转到不同端口的服务中

    场景 Ubuntu Server 16.04 LTS上怎样安装下载安装Nginx并启动: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/detai ...

  3. 二、Nginx配置实例

    Nginx配置实例 一.反向代理 实例一 1.实现效果 打开浏览器,在浏览器地址栏输入地址 www.123.com ,跳转到linux系统tomcat主页面中. 2.准备工作 在linux系统中安装t ...

  4. Nginx 笔记(三)nginx 配置实例 - 反向代理、负载均衡、动静分离

    个人博客网:https://wushaopei.github.io/    (你想要这里多有) 一.反向代理 反向代理准备工作: (1)在 liunx 系统安装 tomcat,使用默认端口 8080 ...

  5. nginx配置实例及多服务器负载

    目录 nginx配置实例 多服务器负载 nginx配置实例 nginx.conf worker_processes 1; events { worker_connections 1024; } htt ...

  6. Nginx 配置实例-配置高可用

    Nginx 配置实例-配置高可用 1. 实现效果 2. 两台机器 nginx 的安装 2.1 192.168.25.120 中 nginx 的安装 2.1.1 安装 pcre 依赖 2.1.2 安装其 ...

  7. Nginx 配置实例-配置动静分离

    Nginx 配置实例-配置动静分离 1. 静态资源的创建 2. nginx 动静分离的配置 3. 验证 1. 静态资源的创建 这里使用的静态资源主要为 HTML 静态文件和图片. mkdir -vp ...

  8. Nginx 配置实例-配置负载均衡

    Nginx 配置实例-配置负载均衡 0. 实例效果 1. 两个 tomcat 的安装(可选) 1.1 tomcat8081 的安装 1.1.1 tomcat8081 安装包的装备 1.1.2 tomc ...

  9. Nginx 配置实例-配置虚拟主机

    Nginx 配置实例-配置虚拟主机 配置基于域名的虚拟主机 1. 配置域名为 aaa.domain.com 的虚拟主机 1.1 nginx 中虚拟主机的配置 1.2 相关目录及文件的创建 1.3 验证 ...

  10. Nginx配置实例-反向代理实现浏览器请求Nginx跳转到服务器某页面

    场景 Ubuntu Server 16.04 LTS上怎样安装下载安装Nginx并启动: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/detai ...

随机推荐

  1. Bash远程代码执行漏洞(CVE-2014-6271)案例分析

    Web服务器和CGI的关系 什么是WEB服务器(IIS.Nginx.Apache) WEB服务器也称为WWW(WORLD WIDE WEB)服务器,主要功能是提供网上信息浏览服务.(1)应用层使用HT ...

  2. Codeforces 886E Maximum Element 组合数学 + dp

    我们定义dp[ i ]表示长度为 i 的序列, 最后没有一个==k的时候返回的方案数, 也就是最后强制返回 i 的方案数. 我们能得到dp方程   dp[ i ] = sum(dp[ i - j - ...

  3. html5的audio实现高仿微信语音播放效果(实际项目)

    HTML部分: <div class="tab-pane fade dialog-record" id="dialogRecord"> <vo ...

  4. Codeforces 555C Case of Chocolate 其他

    原文链接https://www.cnblogs.com/zhouzhendong/p/9272797.html 题目传送门 - CF555C 题意 给定一个 $n\times n(n\leq 10^9 ...

  5. There is no setter for property named 可能产生的原因!

     There is no setter for property named 'operateIP ' in 'class com.chinaunicom.wsp.facade.entity.User ...

  6. android studio使用CMake和NDK,实现应用自身被卸载时打开某一网址

    实现应用自身被卸载时打开某一网址的c代码 MyActivity: public class MyActivity extends Activity { /** * Called when the ac ...

  7. [ 高危 ] mt SQL注入

    RANK  28 金币    28 不是很核心的系统,但是这个检测方法挺新鲜的 数据包 POST /XXXpital HTTP/1.1Content-Length: 96Content-Type: a ...

  8. Java网络编程案例---聊天室

    网络编程是指编写运行在多个设备(计算机)的程序,这些设备都通过网络连接起来. java.net包中JavaSE的API包含有类和接口,它们提供低层次的通信细节.你可以直接使用这些类和接口,来专注于解决 ...

  9. ASP.Net Core中使用jquery-ajax-unobtrusive替换Ajax.BeginForm

    在大潮流下,大家都在研究MVVM框架,但是做面向搜索引擎的外网项目还是得用服务器渲染. 在.Net中肯定就是用Razor模板引擎了. .Net Core断臂式重构后,很多在老得Mvc中使用得好好的一些 ...

  10. 关于eclipse启动报错,an error has occurred.see the log file

    网上搜索各种方法,得知为由于Eclipse卡死或强制关闭之后会出现的情况 提供解决方法一: 查看log文件,发现有这样的信息: !MESSAGE The workspace exited with u ...