Nginx的配置就好像做程序一样,其实很好玩。

笔记一下:
server {
  listen       80;
  server_name  www.aslibra.com;
  set $aslibra_auth "";
  if ( $http_cookie ~* "aslibra_auth=(.+)(?:;|$)" ){
    set $aslibra_auth $1;
  }

  log_format main      '$proxy_add_x_forwarded_for - $remote_user [$time_local] '
           '"$request" $status $bytes_sent '
           '"$http_referer" "$http_user_agent" $aslibra_auth ';
  access_log  /Data/log/nginx-access.log  main;

  location / {
    root   /Data/webapps/www.aslibra.com/;
    index  index.html index.htm;
  }

  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   html;
  }

}


参考分割日志的脚本:

#!/bin/bash
log_dir="/Data/log"
time=`date +%Y%m%d`  
/bin/mv  ${log_dir}/nginx-access.log ${log_dir}/nginx-access.$time.log
kill -USR1 `cat  /var/run/nginx.pid`





原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Tags: ,
发表评论
表情
emotemotemotemotemotemotemotemotemotemotemotemotemot
emotemotemotemotemotemotemotemotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写
 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐