• Nginx使用域名监听80端口,指向不同服务器


    找到nginx.conf编辑

    编辑完记得重启 

    #user  nobody;
    worker_processes  1;
    
    #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;
    }
    
    
    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;
    ##########################主要配置################################
        server {
            listen       80; #监听的端口
            server_name  abc.wsycoon.cn; #域名
            location / {
                proxy_buffering off; #重定向
                proxy_pass http://xxx.xxx.xxx.xxx:808; #实际你要请求的地址
            }
        server {
            listen       80;
            server_name  abcd.wsycoon.xyz;
            location / {
                proxy_redirect off;
                proxy_pass http://xxx.xxx.xxx.xxx:8080;
              }
        }
    ################################################################
    
        # 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;
        #    }
        #}
    
    }
    

      

  • 相关阅读:
    IE浏览器兼容问题
    sublime text3插件和快捷键
    CSS3高级
    盒子模型
    css3动画
    FreeBSD port安装 *** [checksum] Error code 1
    vs 2008设置vs6.0字体
    android 无法读取lua文件问题2
    u盘安装centos6 x8664
    cocos2dx lua 路径问题的一个bug (网络整理)
  • 原文地址:https://www.cnblogs.com/wsycoo/p/14440983.html
Copyright © 2020-2023  润新知