I have a Laravel web app running with no issues here in my DO droplet, but i want to add a subdomain (I.e example.reservate.co) to a URL generated by the Laravel app (Is not a server folder). Is that possible? How do i do that.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

i want to add a subdomain [..] to a URL generated by the Laravel app (Is not a server folder)

I’m not sure I understand what that means—will the same Laravel app work correctly if it is accessed through the new subdomain (i.e. Sub-Domain Routing)?

If so, all you need to do is add DNS record to map the subdomain to your Droplet’s IP address and configure your webserver to serve the same app on the subdomain.

First, add a CNAME record that points to @ which is the root domain (reservate.co):

example CNAME @

Then, edit your nginx configuration adding the new subdomain to your existing server block:

server {
    server_name reservate.co www.reservate.co example.reservate.co;

Finally, restart nginx so that the changes take effect:

sudo service nginx restart
Submit an Answer