Я пытаюсь разместить свое приложение Gatsby на сервере DigitalOcean с помощью nginx.
Сначала я запустил сборку, используя gatsby build
, и вот результат:
success open and validate gatsby-configs — 0.006 s
success load plugins — 0.315 s
success onPreInit — 0.005 s
success delete html and css files from previous builds — 0.006 s
success initialize cache — 0.010 s
success copy gatsby files — 0.014 s
success onPreBootstrap — 0.007 s
success source and transform nodes — 0.126 s
success building schema — 0.290 s
success createPages — 0.000 s
success createPagesStatefully — 0.060 s
success onPreExtractQueries — 0.003 s
success update schema — 0.028 s
success extract queries from components — 0.214 s
success run static queries — 0.231 s — 5/5 21.81 queries/second
success run page queries — 0.020 s — 7/7 355.50 queries/second
success write out page data — 0.015 s
success write out redirect data — 0.000 s
warning The icon(src/images/logo.png) you provided to 'gatsby-plugin-manifest' is not square.
The icons we generate will be square and for the best results we recommend you provide a square icon.
success Build manifest and related icons — 0.276 s
success onPostBootstrap — 0.279 s
info bootstrap finished - 5.276 s
success Building production JavaScript and CSS bundles — 12.984 s
⠂ Building static HTML for pages{ path: '/*',
'*': '404',
uri: '/',
location: { pathname: '/404/', search: '', hash: '' },
navigate: [Function: navigate],
children: undefined,
pageContext: { isCreatedByStatefulCreatePages: true },
pathContext: { isCreatedByStatefulCreatePages: true } }
⡀ Building static HTML for pages{ path: '/*',
'*': '404.html',
uri: '/',
location: { pathname: '/404.html', search: '', hash: '' },
navigate: [Function: navigate],
children: undefined,
pageContext: { isCreatedByStatefulCreatePages: true },
pathContext: { isCreatedByStatefulCreatePages: true } }
success Building static HTML for pages — 5.700 s — 7/7 11.42 pages/second
info Done building in 23.964 sec
После копирования результата сборки из папки public
в мою папку nginx var/www/academy
и проверки его, ничего не отображается и ни один из JS не отображается.
Вот мой конфиг nginx:
# Academy landing page
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name ***************;
server_tokens off;
access_log /var/log/academy/access.log;
error_log /var/log/academy/error.log;
# LetsEncrypt Certification
ssl_certificate ***********
ssl_certificate_key ***********
# SSL Configuration
include snippets/ssl-params.conf;
root /var/www/academy;
index index.html;
}