User Tools

Site Tools


how_to_run_litecart_on_nginx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
how_to_run_litecart_on_nginx [2019/02/10 04:40]
admin
how_to_run_litecart_on_nginx [2019/02/21 00:58] (current)
90.230.2.167
Line 13: Line 13:
   listen ​      80;   listen ​      80;
   server_name ​ www.mydomain.tld;​   server_name ​ www.mydomain.tld;​
-    ​ 
-  #​listen ​      443 ssl; 
-  #​ssl_certificate ​    ​www.example.com.crt;​ 
-  #​ssl_certificate_key www.example.com.key;​ 
-  #​ssl_protocols ​      TLSv1 TLSv1.1 TLSv1.2; 
   ​   ​
 +  # Configure HTTPS and certificate
 +#  listen ​      443 ssl;
 +#  ssl_certificate ​    ​www.example.com.crt;​
 +#  ssl_certificate_key www.example.com.key;​
 +#  ssl_protocols ​      ​TLSv1.2;​
 +  ​
 +  # Define document root and directory index
   root        "/​var/​www/​litecart";​   root        "/​var/​www/​litecart";​
   index       ​index.php index.html index.htm;   index       ​index.php index.html index.htm;
  
 +  # Define some error pages
   error_page 401  "​Access Forbidden";​   error_page 401  "​Access Forbidden";​
   error_page 403  /​error_document?​code=403;​   error_page 403  /​error_document?​code=403;​
Line 28: Line 31:
   error_page 500  "​Internal Server Error";​   error_page 500  "​Internal Server Error";​
   ​   ​
 +  # Let's encrypt
 +  location ~ /​\.well-known { 
 +    allow all;
 +  }
 +  ​
 +  # Deny access to apache configuration files
 +  location ~ /​\.ht(access|passwd) { 
 +    deny all;
 +  }
 +  ​
 +  # Deny access to private storage
 +  location ^~ /​(data|logs|vqmod)/​ { 
 +    deny all;
 +  }
 +  ​
 +  # Add expire header to static content
   location ~* \.(eot|gif|ico|jpg|jpeg|otf|pdf|png|svg|ttf|woff|woff2)$ {   location ~* \.(eot|gif|ico|jpg|jpeg|otf|pdf|png|svg|ttf|woff|woff2)$ {
     expires ​ 7d;     expires ​ 7d;
Line 33: Line 52:
     access_log ​ off;     access_log ​ off;
   }   }
-  ​+ 
 +  # Add shorter expire header to CSS/JS content  ​
   location ~* \.(css|js)$ {   location ~* \.(css|js)$ {
     expires ​ 1d;     expires ​ 1d;
Line 39: Line 59:
     access_log ​ off;     access_log ​ off;
   }   }
 +   
 +  # Add extra password protection to admin folder 
 +  location /admin { 
 +    auth_basic ​           "​Restricted Area";​ 
 +    auth_basic_user_file ​ /​var/​www/​litecart/​admin/​.htpasswd;​  
 +  } 
 +   
 +  # Route URLs through index.php
   location / {   location / {
     try_files $uri $uri/ /​index.php$is_args$args;​     try_files $uri $uri/ /​index.php$is_args$args;​
   }   }
  
 +  # Pass PHP requests to PHP-FPM
   location ~ \.php$ {   location ~ \.php$ {
     fastcgi_pass ​  ​127.0.0.1:​9000;​     fastcgi_pass ​  ​127.0.0.1:​9000;​
Line 51: Line 79:
     include ​       fastcgi_params;​     include ​       fastcgi_params;​
   }   }
-  ​+ 
 +  # Pass PHP requests to FastCGI ​
 #  location ~ \.php$ { #  location ~ \.php$ {
 #    fastcgi_pass ​  ​unix:/​var/​run/​php-fpm/​php-fpm.sock;​ #    fastcgi_pass ​  ​unix:/​var/​run/​php-fpm/​php-fpm.sock;​
Line 59: Line 88:
 #    include ​       fastcgi_params;​ #    include ​       fastcgi_params;​
 #  } #  }
- 
-  location /admin { 
-    auth_basic ​           "​Restricted Area"; 
-    auth_basic_user_file ​ /​var/​www/​litecart/​admin/​.htpasswd; ​ 
-  } 
-  ​ 
-  location ~ /\.ht { 
-    deny  all; 
-  } 
 } }
 </​code>​ </​code>​
how_to_run_litecart_on_nginx.1549770017.txt.gz · Last modified: 2019/02/10 04:40 by admin