On Servebolt, Magento 2 runs in Apache, with nginx as the user facing web server. This means that web server configuration options are set in Apache using .htaccess, not in the nginx config files.

NB! This article is incomplete and is being worked on, if you have questions regarding this - contact us on the chat.

Configuration of static files

Signing of static files should be enabled. This allows you to deploy changes in the theme, without needing to flush down stream caches. 

If you are having trouble with either js and css not updating, or not loading at all after a new deploy of static files (magento setup:static-content:deploy), this is likely your issue.

To check your current settings, Magento 2 must be set to developer mode. You do this by running:

$ magento deploy:mode:set developer

When Magento 2 is in developer mode, go to the Magento 2 admin panel, go to:

Admin > Stores > Configuration > Advanced > Developer > Static Files Settings

The setting for "Sign static files" should be set to "yes". 

This means that Magento will generate a unique URL when static assets are re-deployed (magento setup:static-content:deploy). This again, makes sure that the HTML will contain unique URLs to all static resources, that will bypass the previously cached versions in down stream caches (proxies, CDN's or the browser).

Make sure to set Magento into production mode again afterwards:

$ magento deploy:mode:set production

Pre-requisites for static signing to work

For static signing to work the webserver must know how to treat the signed urls. It does this with the pub/static/.htaccess file. This one should contain the following code:

# Servebolt version of pub/static/.htaccess

<IfModule mod_php7.c>
    php_flag engine 0
</IfModule>

# To avoid situation when web server automatically adds extension to path
Options -MultiViews

<IfModule mod_rewrite.c>
    RewriteEngine On

    ## you can put here your pub/static folder path relative to web root
    #RewriteBase /magento/pub/static/

    # Remove signature of the static files that is used to overcome the browser cache
    RewriteRule ^version.+?/(.+)$ $1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* ../static.php?resource=$0 [L]
    # Detects if moxieplayer request with uri params and redirects to uri without params
    <Files moxieplayer.swf>
      RewriteCond %{QUERY_STRING} !^$
      RewriteRule ^(.*)$ %{REQUEST_URI}? [R=301,L]
     </Files>
</IfModule>

# Removed Magento 2 default bundled settings that are set by nginx or otherwise
Did this answer your question?