[Vuejs]-Vuejs Testing app in web server

1👍

You must be talking about vue-cli. Indeed, when you npm run build the output of your application is in /dist. You would serve the index.html from here.

It would be best to put a web server in front of it, declare the location to serve the assets from (the same as the root path, I’d imagine) and then you’re off to the races.

However, you can also just use ngrok and setup some port forwarding on your local router. This will make it available publicly as well if you just want to preview things.

0👍

You want run Vue-Cli on Server, you do ways after or you see:Deploy a VueJS App with DigitalOcean,How To Set Up a Node.js Application for Production on CentOS 7

step:1: install nodejs on Sever
step:2: install vue-cli (version 2 or 3)
step:3:cd to project, you run command: npm run build
step:4: you need install nginx on server
step:5: sudo nano /etc/nginx/nginx.conf, you edit the following:
server{
	listen 80;
	server_name domail.com 
	root /var/www/project-vue-cli/dist;
	index index.html index.htm index.php
	location / {
		try_files $uri $uri/ =404;
	}

}

step:6: you restart nginx: sudo systemctl restart nginx
step:7: you can open domain

Leave a comment