[英]Deploy nuxt application on a nginx VPS server running ubuntu
I am trying to deploy a nuxt blog to a virtual private server that runs nginx.我正在尝试将 nuxt 博客部署到运行 nginx 的虚拟专用服务器。 The blog is supposed to be accessible when I browse to https://exampledomain.com/articles
当我浏览到https://exampledomain.com/articles时,应该可以访问该博客
I have managed to run npm run dev on the server successifully... The app is running on localhost:3000 on the server....我已经成功地在服务器上运行 npm run dev ......该应用程序正在服务器上的 localhost:3000 上运行......
I need to set a reverse proxy on the server to redirect all requests from https://exampledomain.com/articles/ to localhost:3000我需要在服务器上设置一个反向代理,将所有请求从https://exampledomain.com/articles/重定向到 localhost:3000
I have tried this twice and its failing.... When I browse https://exampledomain.com:3000 the app is loading forever.... when I go to https://exampledomain.com/articles it says "Page not working", or "Internal server error"我曾经尝试这样做两次,其失败....当我浏览https://exampledomain.com:3000应用程序加载永远....当我去https://exampledomain.com/articles它说“页不工作”或“内部服务器错误”
Kindly assist请协助
This could be happening due to incorrect configuration.这可能是由于配置不正确造成的。
Try sudo nano /etc/nginx/sites-available/your-domain.com
试试
sudo nano /etc/nginx/sites-available/your-domain.com
Remember to change the your-domain.com to your desire domain请记住将your-domain.com更改为您想要的域
server {
listen 80;
listen [::]:80;
index index.html;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
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;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.