Skip to content

Instantly share code, notes, and snippets.

@adnanhz
Last active June 25, 2019 11:25
Show Gist options
  • Save adnanhz/2c51e01f31ba234f25519f13936383e8 to your computer and use it in GitHub Desktop.
Save adnanhz/2c51e01f31ba234f25519f13936383e8 to your computer and use it in GitHub Desktop.
How to deploy a Laravel+Vue project to a subfolder in a server

How to deploy laravel + vue to production on a subfolder

  1. composer install, check your env, run key:generate, npm install, all that sh!t. (If you need the full steps comment below)
  2. npm run prod, that will build all Vue stuff and put them in the /public laravel folder
  3. open your Vue router file and set the route base to the subdir (without public, with / at start and end, so if you're deploying to /demo/foo/, type "/demo/foo" as the base). 3.1. You can google how to set route base in vue
  4. go back to the Laravel folder, rename server.php to index.php
  5. copy css, js, assets, fonts, favicon.ico and .htaccess from public folder to root of Laravel project folder
  6. that's it, try accessing your site now

Troubleshooting

Assets won't load

Two options:

  • Copy your assets folder to the root of your webserver directory.
  • IDK, spend hours trying to do it the right way or something.

500 error on favicon.ico

Copy your favicon.ico file to the root of your webserver directory.

@adnanhz
Copy link
Author

adnanhz commented Jun 23, 2019

Note: sometimes I have .example files I set up myself, so check those too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment