Using ngx_pagespeed With nginx On Debian

Discussion in 'HOWTO-Related Questions' started by shiroko, Feb 15, 2014.

  1. shiroko

    shiroko New Member

    Hello all,

    First of all, I'd like to say : Long life to HowtoForge !
    Found many usefull tips and solutions to many issues.

    Today I'm facing a new problem, I followed this tutorial prior to install a Prestashop on my server.

    Everything went smooth, and my e-commerce breaks the sound barrier !

    The only thing is, I can't get the url rewriting to work...
    Do the compilation on this tutorial includes the ngx_http_rewrite_module ?

    If yes, I don't understand why it doesn't work, here is my domain conf file :

    Code:
    pagespeed MemcachedThreads 1;
    	pagespeed MemcachedServers "localhost:11211";
    
    	pagespeed RewriteLevel CoreFilters;
    	pagespeed EnableFilters collapse_whitespace,remove_comments;
    
    	location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
    	location ~ "^/ngx_pagespeed_static/" { }
    	location ~ "^/ngx_pagespeed_beacon" { }
    	location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
    	location /ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
    	location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
    	location /pagespeed_console { allow 127.0.0.1; deny all; }
    
    	# REWRITE 
    
    	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;
            try_files $uri $uri/ /index.php$is_args$args;
            error_page 404 /index.php?controller=404;
    
    
    	location / {
    		try_files $uri $uri/ =404;
    		}
    
    	# PHP
    
    	location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            try_files $uri =404;
            include fastcgi_params;
    	fastcgi_read_timeout 600;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
    		}
    
    Thanks in advance for your help !
     
  2. shiroko

    shiroko New Member

    Solved

    I solved my issue ... it was from my domain conf file.... thanks anyway :)
     

Share This Page