简体   繁体   中英

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. The blog is supposed to be accessible when I browse to 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....

I need to set a reverse proxy on the server to redirect all requests from https://exampledomain.com/articles/ to 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"

Kindly assist

This could be happening due to incorrect configuration.

Try sudo nano /etc/nginx/sites-available/your-domain.com

Remember to change the your-domain.com to your desire domain

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;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM