We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Apache + Nginx + VueJS (Routing) Topic is solved
-
- Posts: 5
- Joined: Fri Jan 11, 2019 5:55 pm
- Os: Debian 7x
- Web: apache + nginx
Apache + Nginx + VueJS (Routing)
Hello guys,
I hope somebody can help me with my problem. I have had some issues with email roundcube, dovecot and phpmyadmin. I solved them all and running into my next issue now.
I have built my finished Vue JS app into a /static/ folder and index.html. When I upload the files to public_html the landing page (i.e. www.example.com) works but anything after / doesnt (i.e. www.example.com/login or www.example.com/register).
The VueRouter is in 'history' mode.
I am running a clean installation of Debian8 on my VPS with VestaCP (Apache + Nginx)
I assume I have to make proper changes to apache configuration, nginx configuration or I don't know what else. [Edit] Maybe webpack also [/Edit]
I hope somebody can help me with this. Greetings.
I hope somebody can help me with my problem. I have had some issues with email roundcube, dovecot and phpmyadmin. I solved them all and running into my next issue now.
I have built my finished Vue JS app into a /static/ folder and index.html. When I upload the files to public_html the landing page (i.e. www.example.com) works but anything after / doesnt (i.e. www.example.com/login or www.example.com/register).
The VueRouter is in 'history' mode.
I am running a clean installation of Debian8 on my VPS with VestaCP (Apache + Nginx)
I assume I have to make proper changes to apache configuration, nginx configuration or I don't know what else. [Edit] Maybe webpack also [/Edit]
I hope somebody can help me with this. Greetings.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
It just seems htaccess directive issue which should be fairly simple to resolve if you read vuejs docs/installation manual properly.
Give us some more info about VueJS and link us to some documentation so we can check.
Give us some more info about VueJS and link us to some documentation so we can check.
-
- Posts: 5
- Joined: Fri Jan 11, 2019 5:55 pm
- Os: Debian 7x
- Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
Vue.js is a javascript framework to build single page web applications with. It has its own router which handles the http requests to the front-end. On my local machine I am developing with npm and all the basic webpack configurations. I think I will have to find a way to make all urls redirect to /public_html/index.html because that is the starting point of my application. I only don't know how to. I cant see any .htaccess files on my server, only in /usr/local/vesta/web/upload/files.
-
- Posts: 5
- Joined: Fri Jan 11, 2019 5:55 pm
- Os: Debian 7x
- Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
I found the solution. I don't know what it does, but this fixed my routing issue:
I just created a .htaccess file in my /public_html/ with the following content:
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</ifModule>
Hope this helps. I think this is not specific to the Vue JS framework but more (if not all) SPA frameworks.
I just created a .htaccess file in my /public_html/ with the following content:
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</ifModule>
Hope this helps. I think this is not specific to the Vue JS framework but more (if not all) SPA frameworks.