-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from staticfile buildpack to nginx buildpack (#375)
* initial commit * switch to nginx buildpack * remove vary, move charset, types align+plain text * disable file cache temporarily * update config * update manifest * add server name * add rewrites and update manifest * move rewrite and cache rules, add missing rules * fix: add config dir to cfignore whitelist * dir prefix * separate config * fix: rename manifest back to original name
- Loading branch information
Showing
8 changed files
with
189 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
* | ||
|
||
!/public | ||
!Staticfile | ||
!buildpack.yml | ||
!mime.types | ||
|
||
!nginx.conf | ||
!/conf.d |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
nginx: | ||
version: mainline |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Gatsby caching recommendations: https://www.gatsbyjs.org/docs/caching/ | ||
|
||
## No-cache | ||
location ~* \.html$ { | ||
add_header Cache-Control "public, max-age=0, must-revalidate"; | ||
expires off; | ||
} | ||
|
||
location /page-data { | ||
add_header Cache-Control "public, max-age=0, must-revalidate"; | ||
expires off; | ||
} | ||
|
||
location /sw.js { | ||
add_header Cache-Control "public, max-age=0, must-revalidate"; | ||
expires off; | ||
} | ||
|
||
## Cache | ||
location /static { | ||
add_header Cache-Control "public, max-age=31536000, immutable"; | ||
expires 1y; | ||
} | ||
|
||
location ~* \.(js|css)$ { | ||
add_header Cache-Control "public, max-age=31536000, immutable"; | ||
expires 1y; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## Permanent rewrites | ||
rewrite /getting-started/developers/(.*) /get-started/develop/\$1 permanent; | ||
rewrite /getting-started/designers /get-started/design permanent; | ||
rewrite /getting-started/about-carbon /get-started/about-carbon permanent; | ||
|
||
rewrite /tutorial/react-(.*) /tutorial/react/\$1 permanent; | ||
rewrite /tutorial/wrapping-up /tutorial/react/wrapping-up permanent; | ||
rewrite /tutorial/overview /tutorial/react/overview permanent; | ||
|
||
rewrite /contributions/(.*) /how-to-contribute/\$1 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
--- | ||
applications: | ||
- name: carbon-website | ||
memory: 64M | ||
buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git | ||
routes: | ||
- route: www.carbondesignsystem.com | ||
- route: carbondesignsystem.com | ||
- route: design-system.mybluemix.net | ||
env: | ||
FORCE_HTTPS: true | ||
- name: carbon-website | ||
buildpack: https://github.com/cloudfoundry/nginx-buildpack.git | ||
routes: | ||
- route: www.carbondesignsystem.com | ||
- route: carbondesignsystem.com | ||
- route: design-system.mybluemix.net |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
types { | ||
text/html html htm shtml; | ||
text/css css; | ||
text/xml xml; | ||
image/gif gif; | ||
image/jpeg jpeg jpg; | ||
application/x-javascript js; | ||
application/atom+xml atom; | ||
application/rss+xml rss; | ||
font/ttf ttf; | ||
font/woff woff; | ||
font/woff2 woff2; | ||
text/mathml mml; | ||
text/plain txt; | ||
text/vnd.sun.j2me.app-descriptor jad; | ||
text/vnd.wap.wml wml; | ||
text/x-component htc; | ||
text/cache-manifest manifest; | ||
image/png png; | ||
image/tiff tif tiff; | ||
image/vnd.wap.wbmp wbmp; | ||
image/x-icon ico; | ||
image/x-jng jng; | ||
image/x-ms-bmp bmp; | ||
image/svg+xml svg svgz; | ||
image/webp webp; | ||
application/java-archive jar war ear; | ||
application/mac-binhex40 hqx; | ||
application/msword doc; | ||
application/pdf pdf; | ||
application/postscript ps eps ai; | ||
application/rtf rtf; | ||
application/vnd.ms-excel xls; | ||
application/vnd.ms-powerpoint ppt; | ||
application/vnd.wap.wmlc wmlc; | ||
application/vnd.google-earth.kml+xml kml; | ||
application/vnd.google-earth.kmz kmz; | ||
application/x-7z-compressed 7z; | ||
application/x-cocoa cco; | ||
application/x-java-archive-diff jardiff; | ||
application/x-java-jnlp-file jnlp; | ||
application/x-makeself run; | ||
application/x-perl pl pm; | ||
application/x-pilot prc pdb; | ||
application/x-rar-compressed rar; | ||
application/x-redhat-package-manager rpm; | ||
application/x-sea sea; | ||
application/x-shockwave-flash swf; | ||
application/x-stuffit sit; | ||
application/x-tcl tcl tk; | ||
application/x-x509-ca-cert der pem crt; | ||
application/x-xpinstall xpi; | ||
application/xhtml+xml xhtml; | ||
application/zip zip; | ||
application/octet-stream bin exe dll; | ||
application/octet-stream deb; | ||
application/octet-stream dmg; | ||
application/octet-stream eot; | ||
application/octet-stream iso img; | ||
application/octet-stream msi msp msm; | ||
application/json json; | ||
audio/midi mid midi kar; | ||
audio/mpeg mp3; | ||
audio/ogg ogg; | ||
audio/x-m4a m4a; | ||
audio/x-realaudio ra; | ||
video/3gpp 3gpp 3gp; | ||
video/mp4 mp4; | ||
video/mpeg mpeg mpg; | ||
video/quicktime mov; | ||
video/webm webm; | ||
video/x-flv flv; | ||
video/x-m4v m4v; | ||
video/x-mng mng; | ||
video/x-ms-asf asx asf; | ||
video/x-ms-wmv wmv; | ||
video/x-msvideo avi; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
worker_processes 1; | ||
daemon off; | ||
|
||
error_log stderr; | ||
events { worker_connections 1024; } | ||
|
||
http { | ||
charset utf-8; | ||
default_type application/octet-stream; | ||
include mime.types; | ||
|
||
keepalive_timeout 15; | ||
autoindex off; | ||
server_tokens off; | ||
port_in_redirect off; | ||
sendfile on; | ||
tcp_nopush on; | ||
|
||
gzip on; | ||
gzip_comp_level 5; | ||
gzip_min_length 256; | ||
gzip_proxied any; | ||
gzip_vary on; | ||
gzip_types | ||
application/javascript | ||
application/x-javascript | ||
application/rss+xml | ||
text/javascript | ||
text/css | ||
text/plain | ||
image/svg+xml; | ||
|
||
|
||
log_format cloudfoundry 'NginxLog "$request" $status $body_bytes_sent'; | ||
access_log /dev/stdout cloudfoundry; | ||
|
||
server { | ||
listen {{port}}; | ||
server_name localhost; | ||
root public; | ||
|
||
## Force https | ||
set $updated_host $host; | ||
if ($http_x_forwarded_host != "") { | ||
set $updated_host $http_x_forwarded_host; | ||
} | ||
if ($http_x_forwarded_proto != "https") { | ||
return 301 https://$updated_host$request_uri; | ||
} | ||
|
||
index index.html; | ||
autoindex off; | ||
|
||
error_page 404 /404; | ||
|
||
include conf.d/*.conf; | ||
} | ||
} |
614fb6a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: