Deploying JW Showcase - jwplayer/jw-showcase GitHub Wiki
JW Showcase can be easily deployed by uploading the application to the public web folder of your server. However, since JW Showcase uses pretty URL's (html5Mode) some minor server configuration is required.
JW Showcase includes a .htaccess file with configuration rules that should work by default in your Apache environment. If it does not work in yours, use the following snippet in the vhost configuration of your site:
<VirtualHost *:80>
ServerName yourdomain
DocumentRoot /var/www
<Directory /var/www>
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html [L]
</ifModule>
</Directory>
</VirtualHost>
By default, JW Showcase assumes the site is in your top-level web document root. If you want to use a subdirectory (for example, http://yourdomain.com/videos/), change the paths in the example above to your paths. For example, to use http://yourdomain.com/videos/``, replace /var/www with /var/www/videos.
Read more about RewriteRules in virtual hosts in the Apache documentation
Update your Nginx configuration location block to include the try_files directive:
location / {
# ...
try_files $uri$args $uri$args/ $uri/ /index.html =404;
}
By default, JW Showcase assumes the site is in your top-level web document root. If you want to use a subdirectory (for example, http://yourdomain.com/videos/), create a new location block for /videos/. For example, to use http://yourdomain.com/videos/, use location /videos/.
Read more about the try_files directive in the Nginx docs
In the Amazon S3 Console, enable static website hosting on the bucket where your Showcase files are stored. Set both the 'Index document' and 'Error document' fields to index.html.
Next, add the following snippet to the Redirection rules in the bucket's Properties panel and change yourdomain.com to your website hostname. For more information about editing bucket properties, see the Amazon S3 documentation.
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>yourdomain.com</HostName>
<ReplaceKeyPrefixWith>#!/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
By default, JW Showcase assumes the site is in your top-level web document root. If you want to use a subdirectory (for example, http://yourdomain.com/videos/), use this rule:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>videos/</KeyPrefixEquals>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>yourdomain.com</HostName>
<ReplaceKeyPrefixWith>videos/#!/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>