User Tools

Site Tools


how_to_run_litecart_on_nginx

How To Run LiteCart On Nginx

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

nginx.conf
server {
  server_name litecart.local;
  listen  80;
  listen  443 ssl;
 
  root  "/var/www/litecart";
  index  index.php index.html index.htm;
 
  error_page 401  "Access Forbidden";
  error_page 403  /error_document?code=403;
  error_page 404  /error_document?code=404;
  error_page 410  /error_document?code=410;
  error_page 500  "Internal Server Error";
 
  location / {
    #add_header  X-Robots-Tag "noindex, follow" always;
    rewrite  ^/(cache|images)/ /$request_uri last;
    try_files  $uri $uri/ /index.php$is_args$args;
  }
 
  location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
  }
 
  location ~ \.(a?png|bmp|css|eot|gif|ico|jpe?g|jp2|js|otf|pdf|svg|tiff?|ttf|webp|woff2?)$ {
    expires     2w;
    add_header  Cache-Control public;
    add_header  Last-Modified "";
    add_header  ETag "";
 
    gzip_static  on;
  }
 
  location ~ \.(htaccess|htpasswd|inc\.php)$ {
    deny  all;
  }
  location ~ ^/storage/(backups|data|logs|vmods)/ {
    deny  all;
  }
  location ~ ^/vendor/ {
    deny  all;
  }
}
how_to_run_litecart_on_nginx.txt · Last modified: 2021/08/18 01:24 by tim