Welcome, Guest Login

Public Cloud Center

Getting Started with Static Sites

Last Updated: Mar 17, 2016 10:17AM EDT
Modulus supports seamless deployments of static sites. The static image uses Nginx 1.6.3 with defaults to serve your content with minimal effort.

Create Project

Creating a static project can be done by choosing Static on the web portal or when creating a project using the CLI. The static runtime is minimal; any servo size will be sufficient for your static project. We recommend 396 MB.


Deploying

The Modulus Static runtime allows you to deploy static assets which will be served using the default server name and configuration.

A basic application includes an index.html file that is served as the index (/) route into the application. Static content will mirror the directory structure of the application.

Customization

Custom configuration is supported by deploying a sites-enabled directory that contains one or more Nginx configuration files. The configuration files can have any file name you choose. You must override server_name within your configuration for it to be applied.

Example custom Nginx configuration:
 
server {
  listen 8080;
  server_name myproject-12345.onmodulus.net;
 
  ##
  # Your custom configuration goes here.
  ##
}

Modulus provides a default configuration that serves most common static sites. Below is the default server block if no custom configuration is supplied.

 
server {
  listen 8080 default_server;
 
  root /mnt/app;
  index index.html index.htm;
 
  location / {
    try_files $uri $uri/ =404;
  }
}
 

Configuring a Single Page App

Single page apps need to serve the main HTML file when routes are hit (i.e. /user/1), but the default configuration will return a 404 error when accessing a route that doesn't map to a file. Use this configuration  in your sites-enabled/nginx.conf file to enable single page apps.

server {
  listen 8080;
  server_name project-12345.onmodulus.net;

  root /mnt/app;
  index index.html index.htm;

  location /.+\..+ {
    try_files $uri $uri/ =404;
  }

  location / {
    try_files $uri /index.html;
  }
}

Go to top
 

Contact Us

    Our Support Policy
    Submit a Support Request

  • Public Cloud Support Hours
    9am-5pm EST Mon-Fri
    Outside of these hours response times may be up to 24hrs.


    Submit a support ticket by clicking 'status and support' icon on the left side of this page.



help@hellotangible.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en_us/portal/articles/autocomplete