在 nginx VPS 服务器 运行 ubuntu 上部署 nuxt 应用程序
Deploy nuxt application on a nginx VPS server running ubuntu
我正在尝试将 nuxt 博客部署到 运行s nginx 的虚拟专用服务器。
当我浏览到 https://exampledomain.com/articles
时应该可以访问该博客
我已成功在服务器上 运行 npm 运行 dev...该应用程序正在服务器 localhost:3000 上 运行ning...
我需要在服务器上设置反向代理以将所有请求从 https://exampledomain.com/articles/ 重定向到 localhost:3000
我已经尝试了两次但都失败了....当我浏览 https://exampledomain.com:3000 时,应用程序一直在加载....当我转到 https://exampledomain.com/articles 时,它显示“页面不工作”或“内部服务器错误”
请协助
这可能是由于配置不正确造成的。
试试看
sudo nano /etc/nginx/sites-available/your-domain.com
记得将 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;
}
}
我正在尝试将 nuxt 博客部署到 运行s nginx 的虚拟专用服务器。 当我浏览到 https://exampledomain.com/articles
时应该可以访问该博客我已成功在服务器上 运行 npm 运行 dev...该应用程序正在服务器 localhost:3000 上 运行ning...
我需要在服务器上设置反向代理以将所有请求从 https://exampledomain.com/articles/ 重定向到 localhost:3000
我已经尝试了两次但都失败了....当我浏览 https://exampledomain.com:3000 时,应用程序一直在加载....当我转到 https://exampledomain.com/articles 时,它显示“页面不工作”或“内部服务器错误”
请协助
这可能是由于配置不正确造成的。
试试看
sudo nano /etc/nginx/sites-available/your-domain.com
记得将 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;
}
}