Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Apache + Nginx + VueJS (Routing) Topic is solved

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
puremilkorwhite
Posts: 5
Joined: Fri Jan 11, 2019 5:55 pm

Os: Debian 7x
Web: apache + nginx
Apache + Nginx + VueJS (Routing)
  • Quote

Post by puremilkorwhite » Fri Jan 11, 2019 6:03 pm

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.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
  • Quote

Post by mehargags » Fri Jan 11, 2019 7:47 pm

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.
Top

puremilkorwhite
Posts: 5
Joined: Fri Jan 11, 2019 5:55 pm

Os: Debian 7x
Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
  • Quote

Post by puremilkorwhite » Fri Jan 11, 2019 8:11 pm

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.
Top

puremilkorwhite
Posts: 5
Joined: Fri Jan 11, 2019 5:55 pm

Os: Debian 7x
Web: apache + nginx
Re: Apache + Nginx + VueJS (Routing)
  • Quote

Post by puremilkorwhite » Fri Jan 11, 2019 8:29 pm

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.
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password