server {
    listen 80;
    server_name xxx.cn www.xxx.cn;
    index        index.html index.htm index.php;
    root /data/web/apps;
    location / {
        try_files $uri $uri/ /index.php?$query_string;

      if ( !-e $request_filename){
        rewrite ^/(.*)$ /index.php?r=$1 last;
      }

    }
    location ~ \.php$ {  
            fastcgi_pass   127.0.0.1:9000;  
#fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # 媒体文件设置缓存 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4)$ { expires 300d; } # js css 文件的缓存(目前在开发阶段,设置一个比较短的时间为好) location ~ .*\.()$ { expires 900h; } location ~ /\.(git|gitignore|ht|svn|src|tmp) { deny all; } }

 

posted on 2016-09-18 10:51  浊浊然  阅读(1240)  评论(0编辑  收藏  举报