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

mohammad6006's avatar

react project as home page

My server is nginx and I deployed Laravel Project

Id like to use react project as home page of my site

how can i config nginx to open react project when I go mysite.com

0 likes
1 reply
trin's avatar

something like this. 4 location ~ \.php get recommended config

http://mysite.com run /var/www/mysite.com/react/build/index.html

http://mysite.com/laravel run /var/www/mysite.com/laravel/public/index.php

server {
	listen 80;
	server_name mysite.com;
	set	$root	/var/www/mysite.com;
	
	index	index.php;

	...

	location / {
		root	$root/react/build;
		index	index.html;
	}

	location /laravel {
		root	$root/laravel/public;
		try_files	$uri	$uri/	/index.php?query_string;
	}
	
	location ~ \.php {
		fastcgi_pass	unix:/var/run/php/php-fpm.sock;
		...
	}
}

Please or to participate in this conversation.