Last active
August 29, 2015 14:03
-
-
Save qfox/961143fb178056eb9188 to your computer and use it in GitHub Desktop.
bem nginx conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($postfix) { | |
set $postfix "-$postfix"; | |
} | |
if ($pages_path = "") { | |
set $pages_path "desktop.bundles"; | |
} | |
set $pages_path "$pages_path$postfix"; | |
# /favicon.ico | |
rewrite ^/favicon.ico$ /$pages_path/favicon.ico last; | |
# / => /desktop.bundles-desktop/index | |
rewrite ^/(\?.*)?$ /$pages_path/index/index.html$1 last; | |
rewrite ^/_(?:\w+)\.(js|css|\w+\.css)(\?.*)?$ /$pages_path/index/_index.$1$2 last; | |
# /page => /$pages_path/page/page.html | |
rewrite ^/(\w+)/(\?.*)?$ /$pages_path/$1/$1.html$2 last; | |
# css, js | |
rewrite ^/(\w+)/_(?:\w+)\.(js|css|\w+\.css)(\?.*)?$ /$pages_path/$1/_$1.$2$3 last; | |
# add final slash to url | |
rewrite ^/([^?/.]+)(\?.*)?$ /$1/$2 permanent; | |
rewrite ^/([^?]+/[^?/.]+)(\?.*)?$ /$1/$2 permanent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream bem-server-alex-home { | |
server localhost:8089; | |
} | |
server { | |
listen 80; | |
server_name bem.dev.local; | |
# set $pages_path "pages"; # if need | |
# set $postfix; | |
location / { | |
include /etc/nginx/conf.d/rewrite/bem; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Host $http_host; | |
proxy_pass http://bem-server-alex-home; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment