Reputation: 13
I have a PHP5.5 module created on Google Cloud's App Engine and a SQL module on Google Cloud SQL.
Here is my PHP app.yaml:
application: myapp
version: 1
runtime: php55
api_version: 1
handlers:
- url: /.*
script: index.php
I am really new into Google Cloud, so I need to somehow create a subdomain such as subdomain.myapp.com
and when my users try to access http://subdomain.myapp.com
instead of http://myapp.com
, I want the server to "give" them the /subdomain/index.php
file instead of the /index.php
file.
Upvotes: 1
Views: 1251
Reputation: 39834
Add both myapp.com
and subdomain.myapp.com
domains to your app in the developer console, see this Q&A: Google cloud DNS: point naked domain to www?
Add a subdomain
module to your app which will serve your subdomain-specific files.
Add a dispatch.yaml
file to dispatch requests based on the domain to their respective module, see this Q&A: AppEngine subdomains to modules without wildcard mapping
Note: if you use SSL and sessions with cross-domain navigation you'll need a wildcard certificate otherwise you'll encounter SSL errors.
You might be able to get away with a single module (lower instance uptime usage/costs) if you tolerate distinct paths in your urls, like this http://subdomain.myapp.com/subdomain/index.php
- in your /index.php
you'd need to parse the domain in the requested url and if it's a subdomain
one then re-direct it to the distinct path instead. No dispatch file needed in this case. Not as clean as the other solution, IMHO.
Upvotes: 2