在Nginx上托管时,Gatsby构建不起作用

时间:2019-05-14 13:06:57

标签: node.js nginx gatsby

我正在尝试使用nginx将我的Gatsby应用程序托管在DigitalOcean服务器上。 我首先使用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;
}

0 个答案:

没有答案