Takeaways from Building a Static Website on Azure


Several official documents have already described clearly about how to build a static website on Azure. By following the step-by-step tutorials, one could successfully create its own website without much to bother with. I have collected the scattered pages together which belong to different components here for better references.

  • https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-how-to (required)
    This is the basic tutorial talking about how to create a storage service and enable static websites.
    After this step: <storage_account>.<region_code>.web.core.windows.net (primary endpoint) is created.

  • https://docs.microsoft.com/en-us/azure/storage/blobs/storage-custom-domain-name (option I)
    This is an easier option for one to enable custom domain by adding a CNAME record in one’s www subdomain to direct traffic to the blob. However, this does NOT allow one to either access the static website via the root domain (without www prefix) or secure the website with HTTPS. Since my goal is to achieve both, an Azure CDN is required.
    After this step: CNAME record www.<domain_name>.<domain> -> <storage_account>.<region_code>.web.core.windows.net (primary endpoint) is created.

  • https://docs.microsoft.com/en-us/azure/cdn/cdn-storage-custom-domain-https (option II)
    The reasons of using Azure CDN are straightforward - support HTTPS and rules engine for redirection. This is the tutorial describing how to access storage blobs using an Azure CDN custom domain over HTTPS, which links to multiple documents below:

    • https://docs.microsoft.com/en-us/azure/cdn/cdn-create-a-storage-account-with-cdn
      This one talks about integrating an Azure storage account with Azure CDN.
      After this step: <endpoint_name>.azureedge.net is created.

    • https://docs.microsoft.com/en-us/azure/dns/dns-delegate-domain-azure-dns
      This one talks about adding a CNAME record mapping to the destination CDN endpoint and associate the domain with the CDN endpoint. However, what is missing here is how to map the root domain to the endpoint. While a CNAME record cannot be placed on a root domain, an A record could. One piece of information sit elsewhere illustrates how to point zone apex to Azure CDN endpoints. With the help of the A record, one can access the site using domain without www prefix.
      After this step: A record www.<domain_name>.<domain> -> <endpoint_name>.azureedge.net is created; A record <domain_name>.<domain> -> <endpoint_name>.azureedge.net is also created;

    • https://docs.microsoft.com/en-us/azure/cdn/cdn-custom-ssl
      This is a simple manual of configuring HTTPS. The note left here is that CDN-managed certificates are not available for root domains. Since HTTPS is already available for www subdomain, redirection with the rules engine could be an easy choice.
      After this step: HTTPS on www.<domain_name>.<domain> is enabled; HTTP 301 HTTP -> HTTPS is enabled.

    • https://docs.microsoft.com/en-us/azure/cdn/cdn-standard-rules-engine
      It provides the solution of enforcing HTTPS via automatic redirection, which serves as a perfect sample for redirecting traffic sent from root domain to the subdomain. A separate rule lies as “if request URL begins with https://domain (to lowercase), then URL redirect moved (with match-request protocol) to hostname www.domain“.
      After this step: HTTP 301 <domain_name>.<domain> -> www.<domain_name>.<domain> is enabled.

After setting everything up, the redirection chain is ready.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
>>> http://cheng.st

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Location: https://cheng.st/
Server: Microsoft-IIS/10.0

>>> https://cheng.st/

> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------

Status: 301 Moved Permanently
Code: 301
Location: https://www.cheng.st/
Server: Microsoft-IIS/10.0

>>> https://www.cheng.st/

> --------------------------------------------
> 200 OK
> --------------------------------------------

Status: 200 OK
Code: 200
Server: Windows-Azure-Web/1.0 Microsoft-HTTPAPI/2.0

外婆家


我心中外婆的形象与妈妈发来的最后几张外婆生前的照片一样,圆脸,咧开嘴的笑,薄嘴唇,双颊的肉紧实的高高隆起,淡淡的眉毛。记事以来到现在总觉得外婆没有特别大的变化。每次去嘉兴,都能听到外婆熟悉的略微有些颤抖的声音,说着我的名字。因为听力不太好,普通话也不太好,外婆常常重复地回应着那些没有听清楚的我的问候。时间的确在外婆的身上留下了印记。记得小时候去外婆家,常常是外婆做饭,只有逢年过节外公才会亲自下厨烧几个硬菜——三黄鸡一直都很拿手。当时外公外婆还写字画画,外公作画外婆在旁边题词,外婆还抄完了厚厚古代小说。渐渐,外婆的手开始不由自主的颤抖,拿筷子端杯子时无法再和从前一样稳稳拿起端起,再后来外公外婆搬了家,从原先的六楼顶楼搬去了一处一楼半的地方。而我也因为日渐长大,离开家越走越远,而越来越少的回去外婆家。

我记忆中外婆的大部分时间都是开心的,我也的确惹着她生气过,她努力提起声音想呵斥我却最后拉着年幼的我,低着头看着我,压着嗓子重复着说我怎么又这么皮,这么不听话。这些记忆大都是十几二十年前,我过年从楼上往下丢鞭炮这样的故事了。在我眼中外婆是不善言辞的,我猜大概也是因为外婆普通话不太好,有时候我们的交流总需要相互之间重复几遍,偶尔还需要妈妈一旁的翻译。不过小时候我被关在房间里看书做作业或者睡觉的时候,总能听见妈妈和外婆坐在外面,生活的琐碎在绵绵密密的声音持续很久。

外婆外公之前住的房子在越秀区,还有些熟悉的街道名字模模糊糊漂浮在脑中,但现在打开了嘉兴地图却无从找起。记得进入小区有一个门房,右手边似乎是一个公司大楼的背面,有一扇大铁门,左边第一幢便是外婆家。一进门的右手就是厕所,约莫一米见方,因为没有窗,所以很暗,在没有安装太阳能热水器之前对这个厕所都没有好印象。进门的左手边有两个并排的卧室,我和爸爸妈妈总是睡刚进门左边的这个,中间一大张床,对着电视机,对面的窗户四周是一圈外公的古玩架子,摆着各种我不敢乱动的瓷瓶子。这么多漫长的暑假让我在想起的这张床时总觉得上面铺着冰凉的席子。进门左手边的另一件卧室连着一个阳台,卧室有一张不大的小床,很古老的木质,另外则都是杂物,阳台上摆了许多花,有一年辣椒结果,我还收到了外公外婆腌渍的辣酱。还有一段时间记得阳台上种了太阳花,整个夏天就一直开,一直开。从家门往里走便是一个不大的长方形客厅,被张椭圆形的大红桌子占据在正中央,上面盖着一块玻璃,压着一些泛黄的历史。桌子周围摆了一圈配套的高背椅子,堵住了墙与桌子的全部空间。一旁矮柜上的电视机换过几代,播放的内容基本都是春节联欢晚会。那个时候每年春节都围着这张桌子。客厅里还摆着一台冰箱,小时候的我自然没有什么话语权,冰箱里自然没有多少我的战利品,上层冷冻室偶尔会摸出几根棒冰,还总被限制不得多吃,仅此而已。冰箱上还摆放过一尊小小的观音的佛像,那几年过年都要跪下好好行礼。客厅的右侧是另外一个小书房,不大,记忆里堆满了东西,偶尔外公会进去翻出一些有意思的东西来,有翻出来几瓶高级的酒,或是泡着蛇,或是泡着杨梅葡萄,或是别的包装精美的酒。我只记得去里面找那些陈年的书,还有电影杂志。不记得具体杂志名字了,外公曾经在报社做过,很长一段时间都会寄杂志过来,那些杂志也陪我消磨过许多时光,直到有一年再去,被告知杂志社不再寄杂志了,愤愤不平。小书房的一旁就是厨房,中间也还有翻新,窗户被拓宽出去包了起来让灶台更宽敞——当时这样的改造十分流行。因为年纪太小,外婆家楼下的小区总没有好好探索过,出了院子大门的半条街以内有个银行,有个商店,再远就不敢一个人继续跑了。

那些支离破碎的小时候的记忆就这样纷乱地散落在这个地方。时间上断断续续,空间里又七零八落。如今的我像是在拼一幅不知道残缺几片的三维拼图,努力拼出一个外婆的家。

外婆是一个在祖父辈中尤为独特的意象。外婆家成为了连锁餐饮的品牌,外婆桥的童谣传唱到现在,外婆的澎湖湾,天黑黑时外婆的歌……外婆,是母亲的母亲,像是将妈妈的美好和温柔成倍成倍地放大,而外婆家是妈妈的家,是家的家。

太阳照常升起


微信依然可以登陆,发送消息,接收消息,依然可以从App Store找到,下载。前几天用WeChat Out致电回10086询问之前一直使用的国内号码,却被告知此号码已经是空号,虽然许久未用,但毕竟是十二年前在新生报到时去逸夫楼二楼和同去朋友一起领取的一个号码,也算是我踏出杭州走向更广阔的世界的一个标志,如今消失于无形,不免唏嘘。最早应该是从高中开始用手机,那个号码已经完全不记得了,用过几代诺基亚,摩托罗拉,当时还流行九宫格键盘笔画输入,上课的时候盲打发短信简直像一个熟练的电报员。本科用了一阵以后有幸换成了第一个iPhone,接下来手机一代一代换,即使之后到了美国,号码还是依然保留着,时不时往里面充点钱续个命,遗憾这两年太久没能有机会回国,“终究是错付了”!

太阳照常升起,种的哈密瓜和金桔在这个夏天却还是没能成功结出果子。接下来要认真总结一下经验和教训,等待明年夏天吧。