nginx初学

  1. 为了避免使用proxy_pass转发找不到主机,导致nginx服务启动失败问题.

    解决方案:

      set $upstream http://bar;

      proxy_pass $upstream;
  2.静态资源缓存设置
    
location /static {
        alias /var/www/static;
        expires 3650d;
        if ($uri ~* .(php|htm|html)$) { // 以php、htm、html结尾的文件不缓存
            expires 0;
        }
    }

  

posted @ 2017-09-12 18:41  周周写  阅读(136)  评论(0编辑  收藏  举报