Skip to content

Instantly share code, notes, and snippets.

@tjunussov
Last active February 3, 2017 18:11
Show Gist options
  • Select an option

  • Save tjunussov/8340088d03a242a4cd9e6993c136d386 to your computer and use it in GitHub Desktop.

Select an option

Save tjunussov/8340088d03a242a4cd9e6993c136d386 to your computer and use it in GitHub Desktop.
Nginx configurations
// PJAX partial or full
map $http_x_pjax $file_suffix {
default "";
true ".partial";
}
## Static html ( converted )
server {
server_name ux.domain;
listen 80;
root /xfaces;
location ~ ^(.+)\.html$ {
try_files $uri.html $1$file_suffix.html =404;
}
location / {
try_files $uri $uri$file_suffix.html last;
}
}
#######
####### Multifolder domains ######
server {
server_name ~^(?<subdomain>\w+)\.domain\.(io|kz|ml)$;
listen 80;
index index.html index.xhtml index.php;
root /var/www/domain.io/$subdomain;
location / {
try_files try_files $uri $uri/ /wildcard.html;
}
location = /wildcard.html {
ssi on;
alias /var/www/domain.io/_.domain.io/index.html;
}
}
# remove the robots line if you want to use wordpress' virtual robots.txt
location = /robots.txt { root /pos/www/default; access_log off; }
location = /favicon.ico { root /pos/www/default; access_log off; }
location / {
xslt_stylesheet /pos/www/dash/index.xsl;
if ($request_filename ~ "^.*/(.+\.xml)$"){
set $fname $1;
add_header Content-Disposition 'attachment; filename="$fname.xls"';
}
#xslt_types text/html;
}
location = /gunluk_satis.xml {
xslt_stylesheet /pos/www/dash.smartpos.io/gunluk_satis.xsl;
if ($request_filename ~ "^.*/(.+\.xml)$"){
set $fname $1;
add_header Content-Disposition 'attachment; filename="$fname.xls"';
}
#xslt_types text/html;
}
# versioning
location ~ ^/v\d+/(.*)$ {
try_files $uri $1 /$1;
}
## Chrome only
map $http_user_agent $browsers {
default /track.html;
~iPhone /track.html;
~Android /track.html;
# ~Trident\/7\.0 /track.html;
# ~Trident /browsers/legacy/track.php;
# ~MSIE /browsers/legacy/track.php;
~Trident\/[3-5]\.[0-9] /browsers/legacy/track.php; # версия IE ниже 10
"~MSIE [1-9]\.[0-9]" /browsers/legacy/track.php; # версия IE ниже 10
}
map $http_accept $req_suffix {
default ".html";
~application/json ".json";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment