Nginx设置Magento项目

server {
    server_name magento.localhost.com;
    root /mysite/magento;
    index index.php;
 
    location / {
        try_files $uri $uri/ /index.php?$args; 
    }
 
    # set a nice expire for assets
    location ~* "^.+\.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
        expires    max;
        add_header Cache-Control public;
    }
 
    # the downloader has its own index.php that needs to be used
    location ~* ^(/downloader|/js|/404|/report)(.*) {
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$1/index.php$1;
        fastcgi_read_timeout 600;
        fastcgi_pass  127.0.0.1:9000;
    }
 
    location ~* \.php {
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_read_timeout 600;
        fastcgi_pass  127.0.0.1:9000;
    }
}

你可能感兴趣的:(Nginx设置Magento项目)