Skip to content

Instantly share code, notes, and snippets.

@alpharder
Created August 14, 2017 09:38
Show Gist options
  • Save alpharder/52de084175883e91e72c315c4987ae64 to your computer and use it in GitHub Desktop.
Save alpharder/52de084175883e91e72c315c4987ae64 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name cscart.dev;
server_name test.cscart.dev;
############################################################################
# listen 443 ssl;
# ssl_certificate /etc/nginx/ssl/nginx.crt;
# ssl_certificate_key /etc/nginx/ssl/nginx.key;
############################################################################
charset utf-8;
############################################################################
access_log off;
error_log /var/log/nginx/cscart.dev.error.log;
############################################################################
set $root "/var/www/cs-cart";
root $root;
############################################################################
error_page 598 = @backend;
############################################################################
# Сжатие
gzip off;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/xml
application/javascript
text/css
text/js
text/xml
application/x-javascript
text/javascript
application/json
application/xml+rss;
# Прочие настройки
client_max_body_size 100m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 5m;
send_timeout 5m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
############################################################################
location @backend {
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 1h;
# include fastcgi_params_ssl.conf;
}
location @fallback {
rewrite ^(.*)$ /index.php?$args last;
}
location @statics {
rewrite ^(.*)$ /index.php?$args last;
access_log off;
rewrite_log off;
expires max;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
############################################################################
location / {
index index.php index.html index.htm;
rewrite ^/api/(.*)$ /api.php?_d=$1&ajax_custom=1&$args last;
try_files $uri $uri/ @fallback;
location ~* \.(jpeg|ico|jpg|gif|png|css|js|pdf|txt|tar|wof|csv|zip) {
access_log off;
try_files $uri @statics;
expires max;
add_header Access-Control-Allow-Origin *;
add_header Cache-Control public;
}
location ~* \.([pP][hH][pP].?)$ {
return 598;
}
location ^~ /app/ {
return 404;
location = /app/addons/rus_exim_1c/exim_1c.php {
return 598;
}
}
location ^~ /app/payments/ {
return 404;
location ~ \.php$ {
return 598;
}
}
location ^~ /app/addons/paypal/payments/ {
return 404;
location ~ \.php$ {
return 598;
}
}
location ^~ /design/ {
allow all;
location ~* \.([tT][pP][lL]|[pP][hH][pP].?)$ {
return 404;
}
}
location ^~ /var/ {
return 404;
location ~* \.(js|css|png|jpeg|jpg|gz|xml|yml)$ {
allow all;
expires 1M;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
}
location ^~ /var/themes_repository/ {
allow all;
location ~* \.([tT][pP][lL]|[pP][hH][pP].?)$ {
return 404;
}
}
location ^~ /images/ {
allow all;
location ~* \.([pP][hH][pP].?)$ {
return 404;
}
}
location = /init.php {
return 404;
}
location ~* \.([tT][pP][lL].?)$ {
return 404;
}
location ~ /\.(ht|git) {
return 404;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment