Reputation: 833
I have a domain bar.com on CloudFlare that is linked to a site hosted on Google Cloud. I can create a new A record on CloudFlare for a subdomain "foo", but how do I map that to bar.com/foo on Google Cloud?
I'm not sure if this question makes sense. Basically, I have a site that is hosted on standard server which I am moving to Google Cloud. On the standard server, I have CPanel which handles creation of subdomains (of which are added to CloudFlare's DNS). I'm not sure how this process is replicated on Google Cloud.
Any help is greatly appreciated!
Upvotes: 4
Views: 12278
Reputation: 618
First of all, you need to create another Google Cloud Storage (GCS) bucket to host your subdomain.
Now, we can proceed to CloudFlare.
- Type: CNAME
- Name: foo (your subdomain)
- Value: c.storage.googleapis.com (default DNS address of GCS)
- TTL: Automatic TTL (or anything else, doesn't matter)
Upvotes: 12
Reputation: 833
I found the solution, it's basically to manually create a entry. I was confused a little because I am using the Bitnami LAMP deployment.
In case this will help somebody in the future, if you're using Bitnami's LAMP, this is how you create subdomain(s)
Open the file /opt/bitnami/apache2/conf/bitnami/bitnami.conf
and add the following:
<VirtualHost *:80>
ServerName foo.bar.com
ServerAdmin [email protected]
DocumentRoot "/opt/bitnami/apache2/htdocs/foo"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/opt/bitnami/apache2/htdocs/foo">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
</VirtualHost>
where foo
is the subdomain. Then restart Apache sudo /opt/bitnami/ctlscript.sh restart apache
If you are using CloudFlare, you will need to add an A entry into your DNS, with foo
as the name, and your Bitnami/Google Cloud deployment's IP. You may leave the status as bypass (grey cloud) or active (orange cloud), it doesn't matter.
Hope it helps somebody!
Upvotes: 0
Reputation: 4409
So you can create subdomains so you have: bar.foo.com
but you can't create a DNS record for foo.com/bar
. Enter CloudFlare, in CloudFlare you can set-up a page rule to redirect foo.com/bar
to bar.foo.com
.
You need to ensure foo.com
is routed through CloudFlare and in DNS settings the cloud is orange. Then you need to make sure the DNS record for bar.foo.com
is pointing to Google's servers instead of your cPanel.
Have fun!
Upvotes: 1