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

jericopulvera's avatar

How to host multiple project in 1 domain name using digitalOcean LEMP stack

I followed this guide.

http://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/ and got it working. now what I want to achieve is to have a url structure like this.

  • 128.199.xxx.xxx/ ->normal index.html
  • 128.199.xxx.xxx/project1 -> laravel project
  • 128.199.xxx.xxx/project2 -> laravel project

and my folder structure will be like this.

  • var/www/index.html
  • var/www/project1/
  • var/www/project2/
0 likes
2 replies
uxappilipinas's avatar
Level 8

Configure nginx to use virtual hosts, point each virtual hosts to corresponding folders on your /var/www/ directory.

1 like
spekkionu's avatar

I would actually recommend against that particular directory structure as you don't want the entire project inside the webroot.

Your directory structure would look more like this

/var/www/html ==> main webroot
/var/www/project1 ==> Laravel project #1 root
/var/www/project2 ==> Laravel project #2 root

The nginx configuration would contain something like this.

root /var/www/html;

location /project1 {
    alias /var/www/project1/public;
}
location /project2 {
    alias /var/www/project2/public;
}

This would give you the url structure you mentioned without having to stick entire applications in the webroot or modifying directory structure of your laravel projects.

Please or to participate in this conversation.