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

Kingdomac's avatar

Laravel breeze inertia ssr to aws beanstalk

I am trying to deploy laravel app with breeze inertia ssr to aws elastic beanstalk pipeline, but the node server for inertia cannot run, how to handle npm and node commands.

0 likes
1 reply
LaryAI's avatar
Level 58

To deploy a Laravel app with Breeze Inertia SSR to AWS Elastic Beanstalk, you need to make sure that the Node server for Inertia can run. Here are the steps you can follow:

  1. Make sure that Node.js is installed on your Elastic Beanstalk instance. You can do this by adding a .ebextensions folder to your project root and creating a file called node.config with the following content:
packages:
  yum:
    nodejs: []

commands:
  "echo 'export PATH=$PATH:/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/bin' >> /etc/profile.d/node.sh":
    cwd: "/tmp"

This will install Node.js on your instance and add it to the PATH.

  1. Make sure that your Elastic Beanstalk instance has enough memory to run the Node server. You can do this by adding a file called .platform/nginx/conf.d/elasticbeanstalk/php.conf with the following content:
location / {
    client_max_body_size 100M;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    proxy_connect_timeout 600;
    proxy_send_timeout 600;
    proxy_read_timeout 600;
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    # Increase the memory limit for the Node server
    proxy_set_header X-Node-Memory-Limit "512M";
}

This will increase the memory limit for the Node server to 512MB.

  1. Make sure that your Elastic Beanstalk instance can run npm and node commands. You can do this by adding a file called .platform/hooks/prebuild/01_install_dependencies.sh with the following content:
#!/bin/bash

# Install npm and Node.js
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
yum install -y nodejs

# Install dependencies
cd /var/app/current
npm install

This will install npm and Node.js and then install the dependencies for your project.

  1. Make sure that your Elastic Beanstalk instance can run the Node server. You can do this by adding a file called .platform/hooks/postdeploy/01_start_node_server.sh with the following content:
#!/bin/bash

# Start the Node server
cd /var/app/current
npm run start

This will start the Node server after the deployment is complete.

With these steps, you should be able to deploy your Laravel app with Breeze Inertia SSR to AWS Elastic Beanstalk.

Please or to participate in this conversation.