- Isaac's Newsletter
- Posts
- How to connect your Laravel Vapor project to a custom domain (with Namecheap)
How to connect your Laravel Vapor project to a custom domain (with Namecheap)
Connect your Laravel project to a custom domain that you bought on Namecheap in 5 minutes
What’s up guys! Happy Saturday.
I’ve shown you how I setup every SaaS project: https://isaac-saas.beehiiv.com/p/saas-project-14-step-guide
I’ve shown you how I deploy those projects to the world wide web: https://isaac-saas.beehiiv.com/p/deploy-laravel-project-laravel-vapor-aws-6-easy-steps
Now, let’s show you how to take that project from a domain like balmy-beijing-sea-octupuses.vapor-farm . com (lol) to an actual domain name that you can use long-term.
My favorite domain registrar, by far, is Namecheap. I’ve been building websites for local businesses the last ~6 years so I’ve used just about all of them and most of them… suck, to say the least. Most importantly, anytime I’ve had a problem, Namecheap’s customer support handles things in less than 10 minutes. With that said, you can most likely take what you read here and apply it to wherever you bought your domain at.
Step 1: Add your domain to Laravel Vapor
After you login, on the left side of the screen underneath “Resources”, click “Domains.” You’ll see a screen like this. Click “Add Domain.”
After you click “Add Domain”, you’ll see a popup like this. Enter your domain.
After you add your domain, you’ll land on this page. We’ll come back to these in just a second.
Scroll down to the bottom of this page and click “Request Certificate.” This will take a few minutes so we’ll let this run in the background while we head over to Namecheap and update our nameservers.
Open a new tab, and go Namecheap.com. Click into your domain and look for the section that says “nameservers” and click “Custom DNS.”
Go back to Vapor and copy and paste those 4 Nameserver records you saw in Vapor. Your “Custom DNS” in Namecheap should look like this.
Here’s a closer look. Click the green check mark to save.
After you save that, we’re going to open up our project in VS Code (or whatever IDE/text editor you use) and open the vapor.yml file and add this:
domain: [yourdomain.com]
It should look like the image below.
After you’ve saved the file, head over to your terminal and run this command:
php vendor/bin/vapor deploy production
After your deployment finishes, head back to your vapor dashboard and your “DNS Records” should automatically be populated. I have a few “mail” records already setup (I’ll show you how to do this in the next newsletter) so yours will have less records than this.
That’s it! As one final check, click into your project in the Vapor dashboard and go to the “Deployments” tab. You should now see your custom domain here underneath “domains.”
Your project is ready for showtime. Now would be a good time to double check your checkout flow and make sure Stripe is setup correctly before sending it to people… can’t tell you how many times I’ve launched something only to find a bug there when someone tries to check out 😂
In my next article, I’ll show you how to setup and automate outbound emails when users perform certain actions in your app like: sign-up, forgot their password, add a collaborator, unsubscribe, etc.
Until next time,
Isaac 💪