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

RoboRobok's avatar

Single Page App on Homestead

Hi guys,

I'd like to create a Single Page App and test it on Homestead server. Everything works fine if I use /public/index.php file - all URLs in my domain are being handled by this file - but how can I tell Homestead to use index.html instead?

0 likes
4 replies
JohnBraun's avatar

The public/index.php file is the bootstrapping of Laravel itself, so you lead all incoming web requests to that file, otherwise the framework wouldn't boot.

RoboRobok's avatar

I know that. My question is how to use index.html. I’m not using Laravel here.

JohnBraun's avatar

Aha, OK.

Since Homestead uses nginx, you should update your server configuration.

I've never used Homestead before, but I assume you have a site available in the /etc/nginx/sites-available folder. I guess you have some server block as listed below. Then, you just update the location / block to use index.html instead of $uri $uri/ /index.php?$query_string.

server {
    listen 80;
    listen [::]:80;

    . . .

    root /var/www/html/quickstart/public;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

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

    . . .
}
RoboRobok's avatar

I never know how to configure Homestead to keep my config when I update it.

Please or to participate in this conversation.