zoukankan      html  css  js  c++  java
  • 企业级Ngnix基于域名的配置_server

    普通的nginx配置

    egrep -v "#|^$" /usr/local/nginx/conf/nginx.conf.default

    image

    更改nginx的配置文件-->注意空格和封号

    cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak 
    vim /usr/local/nginx/conf/nginx.conf
    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        server {
            listen       80;
            server_name  www.baobaotao.com;
            location / {
                root   html/baobaotao;
                index  index.html index.htm;
                }
            }
        server {
            listen       80;
            server_name  www.etiantian.com;
            location / {
                root   html/bbs;
                index  index.html index.htm;
                }
            }
        server {
            listen       88;
            server_name  www.blog.com;
            location / {
                root   html/blog;
                index  index.html index.htm;
                }
            }
    }

    创建虚拟站点目录

    mkdir -p /usr/local/nginx/html/baobaotao
    mkdir -p /usr/local/nginx/html/etiantian
    mkdir -p /usr/local/nginx/html/blog
    echo "www.baobaotao.com" > /usr/local/nginx/html/baobaotao/inhtml
    echo "www.etiantian.com" > /usr/local/nginx/html/etiantian/index.html  
    echo "www.blog.com"      > /usr/local/nginx/html/blog/index.html  
    

    检查配置,重启服务

    cd /usr/local/nginx/sbin
    ./nginx -t 【测试ok后重启服务,-t 表示测试】

    image

    ./nginx -s reload  【测试ok,重启服务】

    image

    配置hosts

    echo "192.168.25.144 www.baobaotao.com" >> /etc/hosts
    echo "192.168.25.144 www.etiantian.com" >> /etc/hosts
    echo "192.168.25.144 www.blog.com" >> /etc/hosts
    tail /etc/hosts
    

    image

    说明:blog设置的是88端口

  • 相关阅读:
    Insubstantial 6.2 Release
    解决异常:Package should contain a content type part [M1.13]
    Peer-to-Peer 综述
    P2P网络穿越 NAT穿越
    Faster_RCNN 2.模型准备(上)
    Pytorch Visdom
    python opencv3添加opencv-contrib
    Pytorch之验证码识别
    Pytorch tutorial 之Datar Loading and Processing (2)
    Pytorch tutorial 之Datar Loading and Processing (1)
  • 原文地址:https://www.cnblogs.com/ftl1012/p/9296079.html
Copyright © 2011-2022 走看看