Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hcastillo's avatar

How deploy laravel + inertia(vue) app in ubuntu server (nginx)

i have been working with laravel and deploy some app. Now, i just for fun want to know if the process to deploy a laravel + inertia app required a new config (like run the npm prod to load the js) o setting in the server.

Anyone that already deploy inertia app can help me with information

0 likes
1 reply
LaryAI's avatar
Level 58

To deploy a Laravel + Inertia app on an Ubuntu server with Nginx, you will need to follow these steps:

  1. Install Nginx on your Ubuntu server if it's not already installed:
sudo apt update
sudo apt install nginx
  1. Configure Nginx to serve your Laravel + Inertia app. Create a new Nginx server block configuration file:
sudo nano /etc/nginx/sites-available/myapp
  1. Inside the file, add the following configuration:
server {
    listen 80;
    server_name your-domain.com;
    root /var/www/myapp/public;

    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

Replace your-domain.com with your actual domain name and /var/www/myapp with the path to your Laravel + Inertia app's root directory.

  1. Enable the Nginx server block configuration:
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/
  1. Test the Nginx configuration for any syntax errors:
sudo nginx -t
  1. If the test is successful, restart Nginx to apply the changes:
sudo systemctl restart nginx
  1. Install Node.js and npm on your server if they are not already installed. You can use the following commands to install them:
sudo apt install nodejs
sudo apt install npm
  1. Navigate to your Laravel + Inertia app's root directory and install the dependencies:
cd /var/www/myapp
npm install
  1. Build the production assets using npm:
npm run prod
  1. Ensure that the appropriate permissions are set for the storage and bootstrap/cache directories:
sudo chown -R www-data:www-data /var/www/myapp/storage /var/www/myapp/bootstrap/cache
  1. Your Laravel + Inertia app should now be deployed and accessible through your domain name.

Note: Make sure you have already configured your domain to point to your server's IP address.

I hope this helps! Let me know if you have any further questions.

Please or to participate in this conversation.