Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
NginX support
 
mencargo
Member
 
Total Posts:  45
Joined:  2008-09-03
 

Clearly this extension aims for permormance optimization.
But this is based on Apache RewriteRules.
I’m no expert on Nginx at this point, but clearly is the way to go, it has droped my loading times from 18 seconds to 5 seconds.
(Default Apache/Nginx installs)
http://tools.pingdom.com/fpt/?url=http://mercadoempresarial.com.mx/&id;=846377

I have found Nginx Rewrite Rules very straight forward, so maybe it’s possible just to implement the rule, my current config file has:

server {
        listen   80
;
        
server_name  mercadoempresarial.com.mx;

        
access_log  /var/log/nginx/localhost.access.log;

        
location {
                root   
/var/www/mercadoempresarial.com.mx;
                
index  index.php index.html;

                
# this serves static files that exist without running other rewrite tests
                
if (-f $request_filename{
                        expires 30d
;
                        break;
                
}

                
# this sends all non-existing file or directory requests to index.php
                
if (!-e $request_filename{
                        rewrite 
^(.+)$ /index.php last;
                
}
        }

        location 
\.php{
                fastcgi_pass   127.0.0.1
:9000;
                
fastcgi_index  index.php;
                
fastcgi_param  SCRIPT_FILENAME  /var/www/mercadoempresarial.com.mx$fastcgi_script_name;
                include /
etc/nginx/fastcgi_params;
        
}

}
 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

Hi mencargo, thanks for posting your rewrites here. I have linked to it from the installation instructions page so others can benefit from it and we hopefully can come up with a fully working solution for Speedster on nginx.

 
Magento Community Magento Community
Magento Community
Magento Community
 
maryanov
Jr. Member
 
Total Posts:  5
Joined:  2009-03-15
Ukraine Nikolaev
 

Hi guys. Thanks for this extension. Here is my rewrite rule for nginx. that *really* make Fooman Speedster working on nginx:
rewrite ^(/index.php)?/minify/([^/]+)(/.*.(js|css))$ /lib/minify/m.php?f=$3&d;=$2 last;
P.S. my Magento lives in root of domain. So if your magento lives somewhere in subfolder you should edit this rule.

 
Magento Community Magento Community
Magento Community
Magento Community
 
thaddeusmt
Member
 
Avatar
Total Posts:  33
Joined:  2009-02-02
Bozeman, MT
 

hmmm, I’m having trouble getting this working.
I did the usual Speedster troubleshooting and have determined that the problem is the redirect/rewrite.

First: the code maryanov posted gives me an “unknown directive” error when I restart nginx because of the “;” in “&d;=$2”
Any ideas on this?

Second, where should the minify rewrite go? this is my file site’s nginx config file (everything else is working fine with it):

server {
listen 80
;
server_name 127.0.0.1;
    
location {
        root 
/var/www/mysite/public/; 
        
index index.php index.html index.htm;

        
# ------------------------DOES IT GO HERE?

        # this serves static files that exist without running other rewrite tests
        
if (-f $request_filename{
        expires 30d
;
        break;
        
}

        
# this sends all non-existing file or directory requests to index.php
        
if (!-e $request_filename{
            
# ------------------------DOES IT GO HERE?
            
rewrite ^(.+)$ /index.php last;         # ----------------------- do I still keep this?
        
}
    }
    location 
\.php{
        fastcgi_pass 127.0.0.1
:9000;
        
fastcgi_index index.php;
        
fastcgi_param SCRIPT_FILENAME /var/www/mysite/public$fastcgi_script_name

        
fastcgi_param QUERY_STRING $query_string;
        
fastcgi_param REQUEST_METHOD $request_method;
        
fastcgi_param CONTENT_TYPE $content_type;
        
fastcgi_param CONTENT_LENGTH $content_length;

        
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        
fastcgi_param REQUEST_URI $request_uri;
        
fastcgi_param DOCUMENT_URI $document_uri;
        
fastcgi_param DOCUMENT_ROOT $document_root;
        
fastcgi_param SERVER_PROTOCOL $server_protocol;

        
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

        
fastcgi_param REMOTE_ADDR $remote_addr;
        
fastcgi_param REMOTE_PORT $remote_port;
        
fastcgi_param SERVER_ADDR $server_addr;
        
fastcgi_param SERVER_PORT $server_port;
        
fastcgi_param SERVER_NAME $server_name;
    
}

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

}

any help is much appreciated!
Thanks,

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

thaddeusmt I don’t have any experience with nginx but I know that this forum software sometimes adds extra characters. maryanov probably posted “&d;=$2” without the extra ;

Please let us know if you manage to get it to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
thaddeusmt
Member
 
Avatar
Total Posts:  33
Joined:  2009-02-02
Bozeman, MT
 

Thanks, Fooman, I think you are right about the forum adding some extra junk. Didn’t fix my problem though, unfortunately. I’m going without your great Speedster module for now on the Nginx server, but I will post here if I get it to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
clockworkgeek
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-31
 

For anyone waiting to know where to edit simply paste this section alongside, but not inside, other location blocks.

location /minify{
    rewrite 
^/minify/([0-9]+)(/.*\.(js|css))$ /lib/minify/m.php?f=$2&d;=$1 last;
}

This was taken from a larger example. I left out the part about ‘index.php’ because I know it won’t ever be used.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Turnkeye
Enthusiast
 
Avatar
Total Posts:  908
Joined:  2008-12-20
URL: turnkeye.com
 

Fooman, \"Magento Extension Speedster\” is really nice extension. We will recommend it to our Magento clients as additional performance improvement to optimize browser rendering. I just send PM to you with some more information.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Aerials
Jr. Member
 
Total Posts:  6
Joined:  2009-05-24
 
clockworkgeek - 06 February 2010 09:24 AM

For anyone waiting to know where to edit simply paste this section alongside, but not inside, other location blocks.

location /minify{
    rewrite 
^/minify/([0-9]+)(/.*\.(js|css))$ /lib/minify/m.php?f=$2&d;=$1 last;
}

This was taken from a larger example. I left out the part about ‘index.php’ because I know it won’t ever be used.

The “;” between “d” and “=$1” should be removed, otherwise you get an error: [emerg]: unknown directive “=$1”

 
Magento Community Magento Community
Magento Community
Magento Community
 
clockworkgeek
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2009-07-31
 
Aerials - 09 May 2010 07:00 PM

The “;” between “d” and “=$1” should be removed, otherwise you get an error: [emerg]: unknown directive “=$1”

You’re right. The forum automatically adds the semicolon because it is trying to complete an HTML entity that starts with an ampersand.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Olof
Sr. Member
 
Total Posts:  152
Joined:  2008-10-17
 

Hi chaps,

Our host makes all files available via Nginx through static.sitexx.co.uk.

So all we need to do is change the www to static on all of the speedster URLs… can anyone help me find a way of dooing this?

Kind regards

Rich

 
Magento Community Magento Community
Magento Community
Magento Community
 
coolio
Jr. Member
 
Total Posts:  18
Joined:  2010-02-10
 

Does the Nginx need to be installed on my server or is it code which i would place directly on the website which i want to increase performance on? It sound really interesting.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

nginx is a replacement for apache - so yes it needs to be installed/configured on your server. In most cases you would need root access to install it (VPS or dedicated server).

 
Magento Community Magento Community
Magento Community
Magento Community
 
rsskga
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-02-15
San Francisco
 

The nginx forum has good info and the nginx mailing list is really friendly and helpful.

I posted my own nginx & magento installation notes here: http://forum.nginx.org/read.php?2,118099,118587#msg-118587

Hope that helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
coolio
Jr. Member
 
Total Posts:  18
Joined:  2010-02-10
 
FOOMAN - 11 October 2010 10:25 AM

nginx is a replacement for apache - so yes it needs to be installed/configured on your server. In most cases you would need root access to install it (VPS or dedicated server).

Very neat i have a dedicated server so that shouldn’t be an issue, have you noticed significant difference? Also are there any knows programs that it would conflict with?

 
Magento Community Magento Community
Magento Community
Magento Community
 
coolio
Jr. Member
 
Total Posts:  18
Joined:  2010-02-10
 
rsskga - 11 October 2010 09:31 PM

The nginx forum has good info and the nginx mailing list is really friendly and helpful.

I posted my own nginx & magento installation notes here: http://forum.nginx.org/read.php?2,118099,118587#msg-118587

Hope that helps!

Nice thanks! very detailed and clear. I dont plan on installing it my self because our servers are live and i dont want to f it all up, i usually send it over to our hosting and they do it for me, this way i have who to blame when things go to sh1t smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2