将Strapi部署到DigitalOcean的Droplet上,并配置Nginx服务器。

huangapple go评论118阅读模式
英文:

Deployment of Strapi to a DigitalOcean droplet with Nginx server

问题

我遇到了一个问题,无法访问部署在运行Ubuntu 18.04的DigitalOcean droplet上的Strapi应用程序。文档已经按照说明进行了操作,但似乎到此为止。

该应用程序明确地在服务器上使用pm2运行。Nginx的服务器块已经按照指南成功设置。然而,最终目标是能够从该域名查看Strapi管理仪表板,而不仅仅是占位符HTML。

是否需要进一步配置以使该应用程序能够从该域名访问?

英文:

I'm having an issue being able to access a Strapi app deployed to a DigitalOcean droplet running Ubuntu 18.04. The docs have been followed but then they just sort of end.

The app is definitely running using pm2 on the server. The Nginx server block has been set up successfully per the guide it seems. However, the end goal is to be able to view the Strapi admin dashboard from that domain, not just the placeholder HTML.

Is there some further configuration required in order for for the app to be accessable from that domain?

答案1

得分: 0

Nginx服务器需要进一步配置。编辑位于 /etc/nginx/sites-available/your_domain 的文件。

location 对象默认应该包含 try_files $uri $uri/ =404;。请将其替换为以下内容:

proxy_pass http://localhost:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
英文:

The Nginx server requires further configuration. Edit the file located at /etc/nginx/sites-available/your_domain.

The location object should have try_files $uri $uri/ =404; by default. Replace this with the following:

proxy_pass http://localhost:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

huangapple
  • 本文由 发表于 2023年5月25日 14:04:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76329344.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定