margherita pizza
margherita pizza

Reputation: 7145

Hosting vuejs spa without nginx or apache in docker

In official vuejs docs it has a simple example of dockerizing a spa. https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app.html#Simple-Example

And it says it will run on localhost:8080

Instead of localhost:8080 can we bind to a domain name and run? Is this possible without nginx or apache?

Upvotes: 0

Views: 715

Answers (1)

I know you didn't ask it, but I will tell my own method. Maybe it helps you

My Vuejs run localhost:8080 but i am using domain for access like sample www.myvueprojectfromlocalhost.com

Firstly I use "vue.config.js" file;

module.exports = {
  devServer: {
    // setting host should not be necessary
    // host: '0.0.0.0:8080'
    public: '0.0.0.0',
    disableHostCheck: true,
  }
 }

Then Apache VirtualHost with ProxyPass;

<VirtualHost *:80>
    ServerName myvueprojectfromlocalhost.com

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

Upvotes: 1

Related Questions