FAQ

Page Discussion Edit History

OsCommerce

[edit] osCommerce example configuration for 0.8.x (maybe 0.7.x too?)

server {
    server_name www.domain.com;
    server_name_in_redirect off;
 
    root /var/www/www.domain.com/catalog;
    access_log /var/www/www.domain.com/logs/access.log;
    error_log /var/www/www.domain.com/logs/error.log;
 
    # expires max on static content
    location / { expires max; }
 
    # Inaccessible locations
    location ~ ^/includes/.*\.php$ { return 403; }
    location ~ ^/admin/includes/.*\.php$ { return 403; }
    location ^~ /admin/backups { return 403; }
    location ^~ /download { return 403; }
 
    # osCommerce rewrites
    location ~ -p-(?<id>[0-9]+)\.html$ { rewrite ^ /product_info.php?products_id=$id; }
    location ~ -c-(?<id>[0-9_]+)\.html$ { rewrite ^ /index.php?cPath=$id; }
    location ~ -m-(?<id>[0-9]+)\.html$ { rewrite ^ /index.php?manufacturers_id=$id; }
    location ~ -pi-(?<id>[0-9]+)\.html$ { rewrite ^ /popup_image.php?pID=$id; }
    location ~ -pr-(?<id>[0-9]+)\.html$ { rewrite ^ /product_reviews.php?products_id=$id; }
    location ~ -pri-(?<id>[0-9]+)\.html$ { rewrite ^ /product_reviews_info.php?products_id=$id; }
 
    # Articles contribution
    location ~ -t-(?<id>[0-9_]+)\.html$ { rewrite ^ /articles.php?tPath=$id; }
    location ~ -a-(?<id>[0-9]+)\.html$ { rewrite ^ /article_info.php?articles_id=$id; }
 
    # Information pages
    location ~ -i-(?<id>[0-9]+)\.html$ { rewrite ^ /information.php?info_id=$id; }
 
    # Links contribution
    location ~ -links-(?<id>[0-9_]+)\.html$ { rewrite ^ /links.php?lPath=$id; }
 
    # Newsdesk contribution
    location ~ -n-(?<id>[0-9]+)\.html$ { rewrite ^ /newsdesk_info.php?newsdesk_id=$id; }
    location ~ -nc-(?<id>[0-9]+)\.html$ { rewrite ^ /newsdesk_index.php?newsPath=$id; }
    location ~ -nri-(?<id>[0-9]+)\.html$ { rewrite ^ /newsdesk_reviews_info.php?newsdesk_id=$id; }
    location ~ -nra-(?<id>[0-9]+)\.html$ { rewrite ^ /newsdesk_reviews_article.php?newsdesk_id=$id; }
 
    # Pass to php
    location ~ \.php$ {
        if (!-f $request_filename) { return 404; }
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param REDIRECT_STATUS 200;
        fastcgi_pass 127.0.0.1:9000;
    }
}