博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Nginx 设置域名转向配置
阅读量:4698 次
发布时间:2019-06-09

本文共 4718 字,大约阅读时间需要 15 分钟。

#运行用户#user www-data;  #启动进程,通常设置成和cpu的数量相等worker_processes 2;#全局错误日志及PID文件error_log logs/error.log;error_log logs/error.log notice;error_log logs/error.log info;#pid logs/nginx.pid;#工作模式及连接数上限events {    #单个后台worker process进程的最大并发链接数    worker_connections 1024; }#设定http服务器,利用它的反向代理功能提供负载均衡支持http {    #设定mime类型,类型由mime.type文件定义    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;        #sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,对于普通应用,必须设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,以平衡磁盘与网络I/O处理速度,降低系统的uptime.    sendfile        on;    #tcp_nopush     on;        #连接超时时间    #keepalive_timeout  0;    keepalive_timeout  65;    #开启gzip压缩    gzip  on;    gzip_disable "MSIE [1-6]\.(?!.*SV1)";    #设定请求缓冲    client_header_buffer_size    1k;    large_client_header_buffers  4 4k;        ############################################################    # tomcat     # listen    :   localhost:80    # redirect  :   localhost:81    ############################################################    server{        listen 80;                                      #侦听端口        server_name  115.55.31.102;                   #定义使用www.xx.com访问                #charset koi8-r;                access_log  logs/localhost81.access.log;    #设定本虚拟主机的访问日志        #默认请求        location / {            root /;                                     # 定义服务器的默认网站根目录位置            index index.aspx;                           # 定义首页索引文件的名称            proxy_pass  http://localhost:81 ;     #请求转向mysvr 定义的服务器列表          }         #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   /root;        }     }            ############################################################    # Tomcat     # listen    :   ts2121.bdqnbky.com:80    # redirect  :   ts2121.bdqnbky.com:8080    ############################################################    server {        listen 80;                                      #侦听端口        server_name  115.55.31.102;                   #定义使用www.xx.com访问                #charset koi8-r;                access_log  logs/localhost8080.com.access.log;    #设定本虚拟主机的访问日志        #默认请求        location / {            root /;                                     # 定义服务器的默认网站根目录位置            index  index.html;                           # 定义首页索引文件的名称            proxy_pass  http://localhost:8080;   #请求转向mysvr 定义的服务器列表          }        #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   /root;        }        # 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;        #}    }    ############################################################    # Tomcat     # listen    :   ts2122.bdqnbky.com:80    # redirect  :   ts2122.bdqnbky.com:8080    ############################################################    server{        listen 80;                                      #侦听端口        server_name  hh.xx.com;                #定义使用www.xx.com访问                #charset koi8-r;                access_log  logs/hh.xx.com.access.log; #设定本虚拟主机的访问日志        #默认请求        location / {            root /;                                     # 定义服务器的默认网站根目录位置            #index index.jsp;                          # 定义首页索引文件的名称            proxy_pass  http://hh.xx.com:8081; #请求转向mysvr 定义的服务器列表          }        #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   /root;        }     }    }

  

转载于:https://www.cnblogs.com/netcorner/p/7426385.html

你可能感兴趣的文章
(Frontend Newbie) Web三要素(一)
查看>>
(转载-学习)python wsgi 简介
查看>>
QPushButton 控制两种状态
查看>>
一点小基础
查看>>
PHP 自动加载类 __autoload() 方法
查看>>
JDK中的Timer和TimerTask详解(zhuan)
查看>>
【python练习】ATM&购物商城程序
查看>>
nginx 日志问题(\x22)
查看>>
装饰器、迭代器、生成器
查看>>
类对象作为类成员
查看>>
面向对象和面向过程的区别及优劣对比详解
查看>>
const与指针
查看>>
thsi指针的一些用法及作用
查看>>
c++友元
查看>>
c++运算符重载
查看>>
一元运算符重载
查看>>
Windows 远程栈溢出挖掘
查看>>
(网页)the server responded with a status of 403 (Forbidden)
查看>>
葡萄城报表介绍:Java 报表
查看>>
android 通知消息一
查看>>