Check this guide
https://www.howtoforge.com/tutorial/ubuntu-laravel-php-nginx/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I have been using Apache virtual hosts to serve my Laravel projects locally in Ubuntu 20.04 and am a complete novice in Nginx, but now I need to set up a server block for a Laravel-Next.js project where the Next.js is located in a /client directory in the laravel app. I am initially trying to just get the laravel project to open but have had no success thus far. My project directory is located in /var/www/test-project. This is the configuration file test-project.com in /etc/nginx/sites-available:
server {
listen 80;
server_name test-project.com www.test-project.com;
root /var/www/test-project/public;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
When I try to open in the browser test-project.com, it just redirects to hugedomains.com. I also have apache in my system, but have stopped the service beforehand and kept only nginx running. Any ideas would be much appreciated
Please or to participate in this conversation.