我有一个使用一些 CSS 和 TypeScript 的 HTML 网页。我一直在使用 ParcelJS 开发服务器来构建和测试我的页面。
现在我想通过 Web 服务器为我的应用程序提供服务。我有一台设置了 nginx 的 Ubuntu 18.10 DigitalOcean droplet/虚拟机。
我将代码克隆到我的服务器上,安装了 ParcelJS,并按照此处parcel build index.html
的说明运行。
然后我尝试通过从/var/www/mysitedomain/html/app.html
to创建一个符号链接来部署我的网页~/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;
}
}