對于做英文網站的站長來說,使用國外的網站空間建站是最合適的,可惜國外好用的免費空間越來越少,剩下的使用上還有諸多限制,那么,做英文網站的站長怎么才能低成本地搭建一個免費靜態HTML網站呢?答案就是通過Google App Engine來實現。
Google App Engine是Google提供的基于Google數據中心的開發、托管網絡應用程序的平臺,每個 Google App Engine 應用程序都可使用1GB存儲空間和每天1G的流量,GAE對于使用資源有各種限制,跑動態網站往往會配置不夠用,但如果網站使用純粹的靜態HTML建立,那么這種網站還是可以支持較大的訪問量。
使用GAE建立靜態網站的方法很簡單,先配置好GAE的環境,然后將靜態網站內容都復制到應用目錄下,然后編輯app.yaml即可。
建議根目錄下少放html文件,次級目錄也不要太多。以下是我建立的一個app.yaml示例文件。在這個例子里,應用名稱為myapp,應用目錄是myapp目錄,靜態文件分別放在html、css、images三個目錄下,根目錄則是index.html、sitemap.html、about.html三個文件,靜態文件的目錄里可以繼續建立子目錄。
之后,使用 appcfg.py update myapp 即可將整個靜態網站上傳到GAE,之后,在GAE的Application Settings - Domain Setup里面添加站長的個人域名即可,添加前需要先用該域名注冊一個Google Apps進行域名身份驗證,注冊驗證完之后即可將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
注:相關網站建設技巧閱讀請移步到建站教程頻道。