zoukankan      html  css  js  c++  java
  • prestashop nginx rewrite rule

    server {
           listen *:80;
           server_name www.mydomain.com *.mydomain.com;
           root /var/www/www.mydomain.com/web;
    
           if ($http_host != "www.mydomain.com") {
                     rewrite ^ http://www.mydomain.com$request_uri permanent;
           }
    
           index index.php index.html;
    
           location = /favicon.ico {
                    log_not_found off;
                    access_log off;
           }
    
           location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
           }
    
           # Deny all for .htaccess, .htpasswd, .DS_Store (Mac).
           location ~ /. {
                    deny all;
                    access_log off;
                    log_not_found off;
           }
    
           rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
           rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
           rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
           rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
           rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
           rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
           rewrite ^/images_ie/?([^/]+).(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
           error_page 404 /index.php?controller=404;
           
           location ~* .(gif)$ {
              expires 2592000s;
           }
           location ~* .(jpeg|jpg)$ {
              expires 2592000s;
           }
           location ~* .(png)$ {
              expires 2592000s;
           }
           location ~* .(css)$ {
              expires 604800s;
           }
           location ~* .(js|jsonp)$ {
              expires 604800s;
           }
           location ~* .(js)$ {
              expires 604800s;
           }
           location ~* .(ico)$ {
              expires 31536000s;
           }
    }
  • 相关阅读:
    osip状态机分析
    配置tomcat 加载指定的jar
    oracle创建用户并指定表空间
    CentOS7通过rsync+crontab实现两台服务器文件同步
    CentOS7配置MySQL5.7主备
    CentOS7本地安装MySQL5.7
    设置mysql 事务锁超时时间 innodb_lock_wait_timeout
    获取指定年月的第一天与最后一天
    Nginx 反向代理504 Gateway Time-out
    ubuntu下安装配置apache2与php
  • 原文地址:https://www.cnblogs.com/trying/p/3655847.html
Copyright © 2011-2022 走看看