zoukankan      html  css  js  c++  java
  • Nginx虚拟主机配置

    1. 基于ip的虚拟主机配置

    假设Nginx服务同时配置了192.168.25.100/141两个IP

    server {
        listen       80;
        server_name  192.168.25.141;
    
        location / {
            root   /usr/share/nginx/html/html-141;
            index  index.html index.htm;
        } 
    }
    
    server {
        listen       80;
        server_name  192.168.25.100;
    
        location / {
            root   /usr/share/nginx/html/html-100;
            index  index.html index.htm;
        } 
    }

    2. 基于端口的虚拟主机配置

    server {
        listen       81;
        server_name  192.168.25.141;
    
        location / {
            root   html-81;
            index  index.html index.htm;
    }
    
    server {
        listen       82;
        server_name  192.168.25.141;
    
        location / {
            root   html-82;
            index  index.html index.htm;
    }

    3. 基于域名的虚拟主机配置

    server {
        listen       80;
        server_name  www.itma.com;
    
        location / {
            root   html-www;
            index  index.html index.htm;
    }
    
    server {
        listen       80;
        server_name  hehe.itma.com;
    
        location / {
            root   html-hehe;
            index  index.html index.htm;
    }
  • 相关阅读:
    TCP流量控制和拥塞控制
    延迟确认和Nagle算法
    浅谈TCP三次握手和四次挥手
    中介者模式
    代理模式
    装饰者模式
    生成器模式(构建者模式)
    策略模式
    模板方法模式
    抽象工厂模式
  • 原文地址:https://www.cnblogs.com/echo1937/p/6442959.html
Copyright © 2011-2022 走看看