Home Tech How to host a basic header footer based php site for free in google appspot
Tech - April 3, 2016

How to host a basic header footer based php site for free in google appspot

Today I will tell you how to create and host a website with GAE for Free. If you have a website or planning for it and your budget is limited.. for example in your name or for your SOHO. You just need to book a domain name (for example from Godaddy, BigRock etc.). And for Hosting with GAE you can just point your domain to GAE by just doing a small changes in your DNS zone file.

Although if you do not want to host it in google cloud you can go for www.freehostia.com chocolate plan which will give you 250 MB Disk space and 1 GB MySQL for free in your account but the issues is you will not get the SMTP services so your contact form will not work. If you do not have a contact form then this is the good choice for the basic hosting. It will gives you email account, but I always prefer go for zoho email. Which is giving 25 Free emails  and each user 5 GB of free space.

But here i will show you how to get a free  Google hosting with its  appspot.com’s cloud deploy.

Google GAE Appspot has some free App Quota and is enough for a SOHO website, so lets see whats it’s offering and when you’ll need a billing upgrade.


Advantages within free Google App Quota 

  • Its free for 1 to 5 GB bandwidth / Day (Every application gets an amount of each resource for free. Free quotas
    can only be exceeded by paid applications, up to the application’s spending limit or the safety
    limit, whichever applies first.)
  • Your website will be lightning speed faster
  • Code & Static Data Storage – First 1 GB Free
  • Outgoing Bandwidth (billable, includes HTTPS) 1 GB  – 56 MB/minute
  • Free Default Resource Limit is 5GB
  • API Call – Total Storage (Documents and Indexes) 0.25 GB
  • Channel Data Sent – 22 MB/minute
  • You have hosted your site in Google
  • Gradually you will learn new things 
  • You can able to host WordPress or HTML or Java sites also
For More please visit this page : https://cloud.google.com/appengine/docs/quotas


So you have a domain name and you want a free hosting, some time giving free hosting to your esteemed client is a very good value added services. 

I have a domain its in Godaddy and Email address in Google. So lets first create a app(here app is your future website). 

  1. Visit Google App Engine and then create an application.
  2. You need Google App Engine Launcher  (download and Install it)
  3. You need Python So this 2.7.11 version only Windows user Download Here (Install it First)

    Please Note: You can try for new GAE App with Python 3+

Now your disk create a folder where you can put your website files, In my case I have One header.php and footer.php Files in server side included (ssi) to Index file. My all image files are ‘image’ or ‘img‘ folder, style sheet files are in ‘css‘ folder and javascript files are in ‘js’ folder so these are the static files.

When I will create a App Engine Application I will get a sub-domain based like site https://acuteservice-1260.appspot.com

My Applications in Google

‹ Prev 20 1-2 of 2 Next 20 ›
Application Title Storage Scheme Location Status
acuteservice-1260 acuteservice High Replication us-central Running
Now you need some verification etc etc For your application and finally in your dashboard you will able to as like above.
My website is simple PHP based with hdeader and footer and a php contact form and do not have a database. So for this reason I need to Create a YAML File to instruct google cloud host to scale my website. So open your Notepad++ or Favo code editor to create an app.yaml file and save it in your website root. So for a Basic PHP site my app.yaml is as below.


app.yaml code

be sure about code formatting, otherwise the code will not work.

application: acuteservice-123
version: 1
runtime: php55
api_version: 1
threadsafe: yes
default_expiration: "4d 5h"

handlers:
- url: /(.*.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))
  static_files: 1
  upload: (.*.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))

- url: /favicon.ico
  static_files: favicon.ico
  upload: favicon.ico
  
- url: /robots.txt
  static_files: robots.txt
  upload: robots.txt  
  
- url: /sitemap.xml
  static_files: sitemap.xml
  upload: sitemap.xml

# Serve php scripts.
- url: /(.+.php)$
  script: 1

- url: /.*
  script: index.php
If you successfully have installed the Google App Engine Launcher then open it and create a ‘New Application’ – Give your application name which one you had created in Google App Engine application. In My case its ‘acuteservice-1260’ which is also mentioned in app.yaml file.

In parent directory give the website path where your physical files are stored for my case its C:xampphtdocsacuteservice.inacuteservice


Now leave rest as it is and hit create and after that you will redirect to Google for verification and authentication. You may required second time to run this app.



Now as you can see the application local version is ready with with Green Icon (1) and if the app is showing its ‘Ok’ and running so its now time to check, through Browse (2) to check in local (also check all internal links are ok and working).

Its now time to deploy means it will work as a FTP but it will keep Sync with your local deploy.

Now we have a subdmain something like https://acuteservice-1260.appspot.com and we need to Point it to a domain which we have in my godaddy.

To point a domain I need to go to Developer Console Version Page (this is a new dashboard, made with material design UI for a better look and feel and nothing else)

The URL is something like this
https://console.cloud.google.com/appengine/versions?project=acuteservice-1260&src=acinvite&pli=1&moduleId=default

As you can see the website is running fine

Version Traffic Share Instances Runtime Environment Size Deployed

100%

1 php55 Standard 34.8 MB Apr 3, 2016, 2:35:36 AM by [email protected]
 
To Point a domain we need to go setting > custom domain tab and click ‘Add a Custom Domain’

Give your domain name there and it will generate a DNS code for you, Someting like below

acuteservice.in none
A
A
A
A
AAAA
AAAA
AAAA
AAAA
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21
2001:4860:4802:32::15
2001:4860:4802:34::15
2001:4860:4802:36::15
2001:4860:4802:38::15

Now go to your Domain Hosting Service Provider or you can book a domain through google only. In My case it is Godaddy so check the below image how i added above records to godaddy domain manage portal. (Click on Add Record to Add A-Host etc.)



Now you have done and your site will come very fast as compare to other hosting service provider. So initial 1 GB is free per day so it it is exceed then you have good visitors so go for paid services means in cloud hosting whatever you use only that need to pay.

If you have any questions please do comment below and i will try to answer it fast.

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

The Speed of Nine Planet

The speed of Sun : Astronomically the Sun is fixed and it is the planets which are moving …