【发布时间】:2019-01-05 04:15:25
【问题描述】:
我有一个 HTML 网页,它使用了一些 CSS 和 TypeScript。我一直在使用 ParcelJS 开发服务器来构建和测试我的页面。
现在我想通过 Web 服务器为我的应用程序提供服务。我有一台设置了 nginx 的 Ubuntu 18.10 DigitalOcean droplet/虚拟机。
我将代码克隆到我的服务器上,安装了 ParcelJS,然后按照说明 here 运行 parcel build index.html。
然后我尝试通过创建从/var/www/mysitedomain/html/app.html 到~/myappdir/dist/index.html 的符号链接来部署我的网页。
这(有点)有效:当我访问我的网站时,我的浏览器会加载我的 index.html。
但是,我的 CSS 都没有呈现,而且我的脚本似乎也没有运行!
很明显,我做错了什么。我应该怎么做才能部署我的应用程序?
这是我删减的 index.html(运行 parcel build index.html 之后):
<!DOCTYPE html>
<head>
<title>Nothing to see here!</title>
<link rel="stylesheet" href="/sidebar.04cc1813.css">
</head>
<body>
<aside class="sidenav">
<h1>A sidebar</h1>
</aside>
<section class="main">
<p>Welcome to the semantic web!</p>
</section>
<script src="/main.9b45144c.js"></script>
</body>
这是我的/etc/nginx/sites-enabled/mysite.com:
server {
listen 80;
listen [::]:80;
root /var/www/mysite.com/html;
index index.html index.htm index.nginx-debian.html app.html;
server_name mysite.com www.mysite.com;
location / {
try_files $uri $uri/ =404;
}
}
【问题讨论】:
标签: nginx deployment web-deployment parceljs