How to host a Laravel web app in NGINX

How to host a laravel web app in NGINX

Are you trying to find a way to host a pure Laravel app on NGINX?

Well you're in luck because in this blog you can find the answer on how to do it.

      1. First go to your project directory:

        example 1

      2. Run npm install to install the packages needed
      3. then run npm run build
      4. next configure the sites-available in nginx directory
      5. you can use this:

        server {
            server_name your_url.com;
            index index.php index.html index.htm;
            root the/directory/of/your/laravel/webapp;
        }

You can use this guide too if you are trying to host a Laravel project with Vue.js. as per my experience hosting this way is the most easiest than containerizing it or running it as a pm2 instance, sure their is an Apache way to host it too if you we're wondering. but with this set-up changing or deleting something from your website is easy from an intruder point of view so for production purposes it is still best if you containerize your project.