zoukankan      html  css  js  c++  java
  • nginx的虚拟站点

    server {
    
        # 服务端口
        listen  80;
    
        # 指定ip或域名 多个域名之间用空格分开
        server_name  www.ktvll.com;
    
        # 默认首页
        index index.html index.htm index.php;
    
        # 网站根目录
        root /alidata/www/default;
    
        # 访问日志
        access_log  /alidata/log/nginx/access/default.log;
    
        # 是否允许列出目录
        autoindex    off;
    
        # 404页面
        error_page 404 = 404.html;
    
        # 各种错误页面
        error_page 500 502 503 504 = 50x.html;
    
        # 错误页面如果小于512k则会在IE下被替换成IE摩恩的错误页面
    
        #  location 语法
        #  /   通用匹配,任何请求都会匹配到
        #  =   开头表示精确匹配
        #  ~   开头表示区分大小写的正则匹配
        #  ~*  开头表示不区分大小写的正则匹配
        #  !~ 和 !~* 分别为区分大小写不匹配及不区分大小写不匹配 的正则
        #  多个location配置匹配顺序为: 从精准到模糊  从=  到/
        #  区分大小写的匹配以 "任意多少个字符" . php或php5的请求
        location ~ .*.(php|php5)?$
        {
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
    
        #  区分大小写的匹配以:
        #  "任意多少个字符" . gif|jpg|jpeg|png|bmp|swf结尾的请求
        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
    
        #  同上
        location ~ .*.(js|css)?$
        {
                expires 1h;
        }
    
        #  expires 为页面缓存时间
    
    }
    

      

  • 相关阅读:
    复习事件委托
    模式学习⑧--观察者模式
    模式学习⑦ --中介者模式
    模式学习(六)--- 策略模式
    模式学习(五)--装饰者模式
    模式学习(四)-迭代器
    模式学习(三)- 工厂模式
    模式学习(二)
    linux rpm包解压
    linux patch中的p0和p1的区别
  • 原文地址:https://www.cnblogs.com/xin-jun/p/9081471.html
Copyright © 2011-2022 走看看