ConceptsBuilds & runtimes
Static sites
For a static site, Ferry makes an nginx image that serves your files on port 80.
With no build step, nginx serves your files as they are.
1 / 3
A static site is the static service type, or the static runtime. nginx serves it.
Deploy a folder of files
A folder of plain files with an index.html needs no build.
ferry up my-site --type static --dir ./publicHow nginx serves the files
- For
/about, nginx looks forabout, thenabout/index.html, thenabout.html. - A page that does not exist gets a 404 status, with your
404.htmlif there is one. - nginx compresses the answers with gzip.
- nginx never serves dotfiles (
.env,.git…), but it serves the files below/.well-known/.
For the two options, see The build of a static site and Publish directory.
When nginx serves the full root directory, Ferry removes Dockerfile.ferry and .git from it.
# Generated by Ferry: static site served by nginx.
# Commit your own Dockerfile to customize the build.
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/* \
&& printf '%s\n' \
'server {' \
' listen 80;' \
' server_name _;' \
' root /usr/share/nginx/html;' \
' index index.html index.htm;' \
' absolute_redirect off;' \
' gzip on;' \
' gzip_vary on;' \
' gzip_min_length 256;' \
' gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml application/manifest+json image/svg+xml;' \
' location / {' \
' try_files $uri $uri/ $uri.html =404;' \
' }' \
' location ~ /\.(?!well-known(/|$)) {' \
' return 404;' \
' }' \
' error_page 404 /404.html;' \
'}' \
> /etc/nginx/conf.d/default.conf
COPY . /usr/share/nginx/html/
RUN rm -rf /usr/share/nginx/html/Dockerfile.ferry* /usr/share/nginx/html/.git
EXPOSE 80