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

moizbaloch's avatar

I want to host my Laravel 5.6 Application in Sub Domain

After 10 days working i finally able to deploy my first laravel web app,

I got the video in which he is doing very well and defining it everything is ok but the problem is " The guy in video has only one domain mean primary and he is placing public folder files inside public_html but in my case i have many domains for my this laravel app im placing files under subdomain so the question is Where should i place Public folder files of app"

I hope my problem is clear and make sense if not then please let me know I will brief it more as well.

Search in Youtube ( Deploy Laravel To Shared Hosting The Easy Way ) you will get video which i'm following for deploying app

Thansk Moiz

0 likes
1 reply
franckysolo's avatar

You have to configure your server to point to your subdomain directory i suppose you have a linux server and your domain is example.com

here an example with apache :


<VirtualHost *:80>

    ServerAdmin     [email protected]
    ServerName      subdomain.example.com
    DocumentRoot    "/var/www/html/subdomain/public"

    AddDefaultCharset utf-8

    <Directory "/var/www/html/subdomain/public">
        Options FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
    </Directory>

    <FilesMatch \.php$>
        SetHandler proxy:unix:/var/run/php/subdomain-fpm.sock|fcgi://dummy
    </FilesMatch>

    <IfModule mod_rewrite.c>
      RewriteEngine Off
      <location />
          RewriteEngine On
          DirectorySlash Off
          RewriteCond %{REQUEST_FILENAME} -s [OR]
          RewriteCond %{REQUEST_FILENAME} -l [OR]
          RewriteCond %{REQUEST_FILENAME} -d
          RewriteRule ^.*$ - [NC,L]
          RewriteRule ^.*$ /index.php [NC,L]
      </Location>
    </IfModule>

    ErrorLog        ${APACHE_LOG_DIR}/subdomain-error.log
    LogLevel        warn
    CustomLog       ${APACHE_LOG_DIR}/subdomain-access.log combined
</virtualHost>

i think you can get example with nginx on this forum already posted

Then you to put your files on your server with ftp or git

Directory structure in /var/www/html :

app/
boostrap/
config/
database/
public/
resources/
...

Please or to participate in this conversation.