Report this

What is the reason for this report?

Add a subdomain to a URL of my website.

Posted on September 18, 2016

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.

Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.