I have a website builder that allows customers to build static websites for a niche. I want to offer my customers to host their static websites on my own server but I'm stuck at how to do it properly.
It should be possible to search for *.app.com and display the website of the customer. Also, I want them to offer to have their own domain linked to the website which is a feature of a subscription of the app.
What is the a good approach to solve this problem?
I currently have an ec2 instance which handles all request with nginx. I also have a wildcard domain.
For testing I figured out that you can use an S3 bucket and store multiple pages as a folder in one bucket and use nginx to redirect *.app.com to the S3 folder/address and display the content.
I've seen others like heroku providing an IP or DNS address which the customer would link their own domain to it.
I thought about doing the same but I'm currently stuck at what to use to create those DNS addresses and how to store the page content properly to display it for the right domain.
Currently, when you try to access *.app.com, nginx will redirect you to the right content in S3.
server {
listen 80 default_server;
server_name ~^(?<subdomain>[^.]+).app.com;
location / {
resolver 8.8.8.8 valid=60s;
resolver_timeout 10s;
proxy_cache_bypass $http_cache_control;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_pass https://s3.amazonaws.com/app/sites/$subdomain$request_uri;
}
}
How can I make it possible to allow my clients setting up custom domains and subdomains easy & fast?
Aucun commentaire:
Enregistrer un commentaire