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;
           }
    }
  • 相关阅读:
    CentOS7.4 chrony时间同步服务器部署(替代NTPD)
    Zabbix Agent for Windows部署(五)
    Zabbix3.4.5部署安装(二)
    Zabbix概术及基础介绍(一)
    修改zabbix为中文,并解决乱码问题(三)
    ZABBIX 3.4 监控Nginx 状态(七)
    PXE+Kickstart 全自动安装部署CentOS7.4
    Zabbix Agent for Linux部署(四)
    不能在 DropDownList 中选择多个项 原因分析及解决方法
    IE浏览器下的CSS问题
  • 原文地址:https://www.cnblogs.com/trying/p/3655847.html
Copyright © 2011-2022 走看看