diff options
Diffstat (limited to 'meta-openbmc-machines')
3 files changed, 35 insertions, 2 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend new file mode 100644 index 000000000..ea818947e --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend @@ -0,0 +1,16 @@ +do_install_append () { + +# The webui content is served as pre-compressed gzip content. While nginx can +# handle this via the gzip_static directive (and we use that), the nginx +# try_files directive (which we also use) searches the URI as-is. The suggested +# workaround is to have an empty uncompressed file with the same name as the +# compressed file. This does not impact the functionality of gzip_static. +# So for eg if there's an index.html.gz, create an empty index.html. Same goes +# for all the webui content. +# https://serverfault.com/questions/571733/nginx-gzip-static-why-are-the-non-compressed-files-required +# https://www.ruby-forum.com/topic/4402481 +# https://trac.nginx.org/nginx/ticket/1367 + +find ${D}${datadir}/www -type f -name '*.gz' -exec sh -c 'touch `dirname "$0"`/`basename "$0" .gz`' '{}' \; + +} diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/files/nginx.conf b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/files/nginx.conf index 89e575af5..7d65183ec 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/files/nginx.conf +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/files/nginx.conf @@ -65,12 +65,29 @@ http { ssl_prefer_server_ciphers on; location / { + # This location lets us serve the static pre-compressed webui + # content (rooted at /usr/share/www). Also if the URI points to + # something else (that is unmatched by other locations), we + # fallback to the rest server. This approach is based on the + # guide at https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content. + root /usr/share/www; + # For clients that support gzip encoding, serve them + # pre-compressed gzip content. For clients that don't, + # uncompress on the BMC. The module gunzip requires + # gzip_static to be set to 'always'; gzip_static is the + # module that serves compressed content for clients that + # support gzip. + gunzip on; + gzip_static always; + try_files $uri $uri/ @rest_server; + } + location @rest_server { # Use 127.0.0.1 instead of localhost since nginx will # first use ipv6 address of ::1 which the upstream server # is not listening on. This generates an error msg to # the journal. Nginx then uses the 127.0.0.1 and everything # works fine but want to avoid the error msg to the log. - proxy_pass http://127.0.0.1:8081/; + proxy_pass http://127.0.0.1:8081; # WebSocket support proxy_http_version 1.1; diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/nginx_%.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/nginx_%.bbappend index 8a58341ea..8eb7e402b 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/nginx_%.bbappend +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/recipes-httpd/nginx/nginx_%.bbappend @@ -9,7 +9,7 @@ SRC_URI += " \ file://gen-cert.sh \ " -EXTRA_OECONF =+ " --without-select_module" +EXTRA_OECONF =+ " --without-select_module --with-http_gunzip_module" SSLCERTPATH = "/etc/ssl/certs/nginx/" |