• nginx 静态文件部署 极简版


    nginx的html文件夹目录结构

     将html下的index.html文件分别放到三个文件夹中,稍作改动,以示区分

    修改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       8090;
            server_name  localhost;
    
            location /mobile {
                root   html;
                index  index.html index.htm;
            }
            
            location /circle {
                root   html;
                index  index.html index.htm;
            }
            
            location /knowledge {
                root   html;
                index  index.html index.htm;
            }
           
        }
    }

    保存,运行nginx

    分别访问三个路径下的index.html

     

  • 相关阅读:
    帮助理解Docker,生动装逼介绍Docker
    Java 最常见 200+ 面试题 + 全解析
    CentOS7.0 yum安装 docker
    集合总结
    C#复习笔记
    match方法的使用
    偏函数
    通用装饰器
    装饰器修饰带参数的功能函数
    多个装饰器的使用
  • 原文地址:https://www.cnblogs.com/wulisz/p/16370878.html
Copyright © 2020-2023  润新知