zoukankan      html  css  js  c++  java
  • 通过端口区分不同虚拟机

    1.   配置虚拟主机

    就是在一台服务器启动多个网站。

    如何区分不同的网站:

      1. 域名不同

      2. 端口不同

    2. 通过端口区分不同虚拟机

    Nginx的配置文件:

    /usr/local/nginx/conf/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  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm;
            }
        }
    }

    2.1 可以配置多个server,配置了多个虚拟主机。

      添加虚拟主机:

    #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  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm;
            }
        }
        server {
            listen       81;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html-81;
                index  index.html index.htm;
            }
        }
    }

    2.2 重新加载配置文件

    [root@localhost nginx]# sbin/nginx -s reload

  • 相关阅读:
    images have the “stationarity” property, which implies that features that are useful in one region are also likely to be useful for other regions.
    算法报告
    word2vec_basic.py
    Softmax_function
    Convex combination
    函数的光滑化或正则化 卷积 应用 两个统计独立变量X与Y的和的概率密度函数是X与Y的概率密度函数的卷积
    world embedding 嵌入
    dump json 显示中文问题
    dump json 显示中文问题
    perl $d = encode_utf8($r); $f = decode_json($d)
  • 原文地址:https://www.cnblogs.com/jingjiren/p/13125672.html
Copyright © 2011-2022 走看看