Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
###############
# HTTPS VHOST #
###############
server {
######################
# REGULAR PARAMETERS #
######################
server_name {domain};
root {directory};
index index.php;
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
# Comment this if you are not using Certbot
ssl_certificate /etc/letsencrypt/live/{domain}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{domain}/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
error_log /var/log/nginx/{domain}.error;
########################
# LOCATION DIRECTIVES #
########################
# PHP Status monitor, uncomment if needed (you have to enable it in your PHP-FPM pool config)
# location ~ ^/(status|ping)$ {
# allow 127.0.0.1;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_index index.php;
# include fastcgi_params;
# fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# }
# Change this to your default admin path (for ex. /admin-mywebsite ; prefix the URL with a "/")
set $admin_dir {admin-directory};
# Symfony controllers
location ~ /(international|sell|improve|_profiler|module|product|feature|attribute|supplier|combination|specific-price|configure)/(.*)$ {
try_files $uri $uri/ /index.php?q=$uri&$args $admin_dir/index.php$is_args$args;
}
# Default locations
location / {
try_files $uri $uri/ /index.php$uri&$args;
}
# Use only one of the following php location according to your PHP configuration
location ~ [^/]\.php(/|$) {
# Verify that the file exists, redirect to index if not
try_files $fastcgi_script_name /index.php$uri&$args =404;
fastcgi_index index.php;
# Environment variables for PHP
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Optimized for CloudFlare CDN, if you are not using it you can increase theses variables according to your needs
fastcgi_keep_conn on;
fastcgi_read_timeout 100s;
fastcgi_send_timeout 100s;
client_max_body_size 20M;
fastcgi_max_temp_file_size 0;
fastcgi_temp_file_write_size 512k;
# Change this for your PHP socket
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
# If the PHP directive from the top didn't work, use the following one:
# location ~ \.php$ {
# try_files $uri =404;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
# }
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
location ~* ^.+\.(css|js|ogg|ogv|svg|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(pdf)$ {
expires 30d;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
deny all;
}
location ~ \.(htaccess|yml|log|twig|sass|git|tpl)$ {
deny all;
}
# vendor in modules directory
location ~ ^/modules/.*/vendor/ {
deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
deny all;
}
# Prevent injection of php files
location /upload {
location ~ \.php$ {
deny all;
}
}
location /img {
location ~ \.php$ {
deny all;
}
}
######################
# REWRITE DIRECTIVES #
######################
# Uncomment & edit this if you are using multilanguage (preset for french here)
# rewrite ^/fr$ /fr/ redirect;
# rewrite ^/fr/(.*) /$1;
# Rewrite for admin directory
location $admin_dir/ {
if (!-e $request_filename) {
rewrite ^/.*$ $admin_dir/index.php last;
}
}
# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
# Products and regular pages
rewrite "^/([0-9]+)\-(\P{M}\p{M}*)+\.html(.*)$" /index.php?controller=product&id_product=$1$3 last;
rewrite "^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=category&id_category=$1$3 last;
rewrite "^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$" /index.php?controller=product&id_product=$2$4 last;
rewrite "^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$" /index.php?controller=supplier&id_supplier=$1$3 last;
rewrite "^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$" /index.php?controller=manufacturer&id_manufacturer=$1$3 last;
rewrite "^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms=$1$3 last;
rewrite "^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$" /index.php?controller=cms&id_cms_category=$1$3 last;
rewrite "^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$" /index.php?fc=module&module=$1&controller=$2 last;
# EN rewrites
rewrite ^/address$ /index.php?controller=address last;
rewrite ^/addresses$ /index.php?controller=addresses last;
rewrite ^/authentication$ /index.php?controller=authentication last;
rewrite ^/best-sales$ /index.php?controller=best-sales last;
rewrite ^/brand$ /index.php?controller=manufacturer last;
rewrite ^/brand/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /index.php?id_manufacturer=$1&controller=manufacturer;
rewrite ^/cart$ /index.php?controller=cart last;
rewrite ^/contact-us$ /index.php?controller=contact-form last;
rewrite ^/discount$ /index.php?controller=discount last;
rewrite ^/guest-tracking$ /index.php?controller=guest-tracking last;
rewrite ^/identity$ /index.php?controller=identity last;
rewrite ^/manufacturers$ /index.php?controller=manufacturer last;
rewrite ^/my-account$ /index.php?controller=my-account last;
rewrite ^/new-products$ /index.php?controller=new-products last;
rewrite ^/new-products$ /index.php?controller=new-products last;
rewrite ^/order$ /index.php?controller=order last;
rewrite ^/order-follow$ /index.php?controller=order-follow last;
rewrite ^/order-follow$ /index.php?controller=order-follow last;
rewrite ^/order-history$ /index.php?controller=history last;
rewrite ^/order-slip$ /index.php?controller=order-slip last;
rewrite ^/page-not-found$ /index.php?controller=404 last;
rewrite ^/password-recovery$ /index.php?controller=password last;
rewrite ^/quick-order$ /index.php?controller=order-opc last;
rewrite ^/search$ /index.php?controller=search last;
rewrite ^/stores$ /index.php?controller=stores last;
rewrite ^/supplier$ /index.php?controller=supplier last;
# FR rewrites
rewrite ^/adresse$ /index.php?controller=address last;
rewrite ^/adresses$ /index.php?controller=addresses last;
rewrite ^/avoirs$ /index.php?controller=order-slip last;
rewrite ^/commande$ /index.php?controller=order last;
rewrite ^/commande-rapide$ /index.php?controller=order-opc last;
rewrite ^/comparaison-produits$ /index.php?controller=products-compare last;
rewrite ^/confirmation-commande$ /index.php?controller=order-confirmation last;
rewrite ^/connexion$ /index.php?controller=authentication last;
rewrite ^/fabricants$ /index.php?controller=manufacturer last;
rewrite ^/fournisseur$ /index.php?controller=supplier last;
rewrite ^/fournisseurs$ /index.php?controller=supplier last;
rewrite ^/historique-commandes$ /index.php?controller=history last;
rewrite ^/identite$ /index.php?controller=identity last;
rewrite ^/magasins$ /index.php?controller=stores last;
rewrite ^/meilleures-ventes$ /index.php?controller=best-sales last;
rewrite ^/mon-compte$ /index.php?controller=my-account last;
rewrite ^/nous-contacter$ /index.php?controller=contact-form last;
rewrite ^/nouveaux-produits$ /index.php?controller=new-products last;
rewrite ^/page-introuvable$ /index.php?controller=404 last;
rewrite ^/panier$ /index.php?controller=cart last;
rewrite ^/plan-site$ /index.php?controller=sitemap last;
rewrite ^/promotion$ /index.php?controller=discount last;
rewrite ^/promotions$ /index.php?controller=prices-drop last;
rewrite ^/recherche$ /index.php?controller=search last;
rewrite ^/recuperation-mot-de-passe$ /index.php?controller=password last;
rewrite ^/reduction$ /index.php?controller=discount last;
rewrite ^/sitemap$ /index.php?controller=sitemap last;
rewrite ^/suivi-commande$ /index.php?controller=order-follow last;
rewrite ^/suivi-commande-invite$ /index.php?controller=guest-tracking last;
}
#################
# HTTP REDIRECT #
#################
server {
server_name {domain};
if ($host = {domain}) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
return 404;
}