
對于做英文網(wǎng)站的站長(cháng)來(lái)說(shuō),使用國外的網(wǎng)站空間建站是最合適的,可惜國外好用的免費空間越來(lái)越少,剩下的使用上還有諸多限制,那么,做英文網(wǎng)站的站長(cháng)怎么才能低成本地搭建一個(gè)免費靜態(tài)HTML網(wǎng)站呢?答案就是通過(guò)Google App Engine來(lái)實(shí)現。
Google App Engine是Google提供的基于Google數據中心的開(kāi)發(fā)、托管網(wǎng)絡(luò )應用程序的平臺,每個(gè) Google App Engine 應用程序都可使用1GB存儲空間和每天1G的流量,GAE對于使用資源有各種限制,跑動(dòng)態(tài)網(wǎng)站往往會(huì )配置不夠用,但如果網(wǎng)站使用純粹的靜態(tài)HTML建立,那么這種網(wǎng)站還是可以支持較大的訪(fǎng)問(wèn)量。
使用GAE建立靜態(tài)網(wǎng)站的方法很簡(jiǎn)單,先配置好GAE的環(huán)境,然后將靜態(tài)網(wǎng)站內容都復制到應用目錄下,然后編輯app.yaml即可。
建議根目錄下少放html文件,次級目錄也不要太多。以下是我建立的一個(gè)app.yaml示例文件。在這個(gè)例子里,應用名稱(chēng)為myapp,應用目錄是myapp目錄,靜態(tài)文件分別放在html、css、images三個(gè)目錄下,根目錄則是index.html、sitemap.html、about.html三個(gè)文件,靜態(tài)文件的目錄里可以繼續建立子目錄。
之后,使用 appcfg.py update myapp 即可將整個(gè)靜態(tài)網(wǎng)站上傳到GAE,之后,在GAE的Application Settings - Domain Setup里面添加站長(cháng)的個(gè)人域名即可,添加前需要先用該域名注冊一個(gè)Google Apps進(jìn)行域名身份驗證,注冊驗證完之后即可將Google Apps刪除 。
application: myapp
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /html
static_dir: html
- url: /css
static_dir: css
- url: /images
static_dir: images
- url: /sitemap\.html
static_files : sitemap.html
upload: sitemap.html
- url: /about\.html
static_files : about.html
upload: about.html
- url: /.*
static_files : index.html
upload: index.html

