How To Run LiteCart On Nginx

This is a configuration example how to run LiteCart on NginX.

nginx.conf :

events {

    worker_connections  1024;

}

http {

    include   mime.types;

    include  "vhosts/litecart-local.conf";

} 

vhosts/litecart.local.conf:

server {

    server_name litecart.local;
    listen  80;

    #listen  443 ssl;
    #ssl_certificate /etc/ssl/certs/domainname-ssl-bundle.crt;
    #ssl_certificate_key /etc/ssl/private/domainname.key;

    root  "/path/to/litecart";
    index  index.php index.html index.htm;

    location / {
            rewrite  ^/(cache|images)/ /$request_uri last;
            try_files  $uri $uri/ /index.php$is_args$args;
    }

    location ~ .php$ {
            include        conf/fastcgi_params;

            #fastcgi_pass   127.0.0.1:9123;
            fastcgi_pass   unix:/run/php/php8.1-fpm.sock;

            fastcgi_param  REDIRECT_HTTP_MOD_REWRITE  On;  # Enables LiteCart's URL rewriting
    }

    location ~ .(a?png|bmp|css|eot|gif|ico|jpe?g|jp2|js|otf|pdf|svg|tiff?|ttf|webp|woff2?)$ {
            expires  2w;
            gzip_static  on;
    }

    location ~ .(htaccess|htpasswd|inc.php)$ {
            deny  all;
    }
    location ~ ^/(data|logs|vendor|vmods|vqmod)/ {
            deny  all;
    }
}

Revisions

Top Editors
Recently Edited Articles