第一次遇到这个问题,还是我少做了什么⋯⋯?虽然离上次类似操作应该有半年了,不至于忘记什么呀
ubuntu 18.04 LTS
apache 2.4.29
我的DNS在 Cloudflare ,首先去域名设定
我设定两个子域名
假设叫做 theta.xxx.com 与 beta.xxx.com
也绑定到正确的服务器IP位址
用CLI在该服务器安装了 apache 防火墙和相关我需要的资源后,进入 etc/apache2 的 apache2.conf 设定
<Directory /var/www/theta>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/beta>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
也到 sites-available 新增两个 conf 文件
分别为 theta.conf 与 beta.conf
theta.conf 设定为
<VirtualHost *:80>
ServerName theta.xxx.com
ServerAdmin xxx@xxx.com
DocumentRoot /var/www/theta
</VirtualHost>
beta.conf设定为
<VirtualHost *:80>
ServerName beta.xxx.com
ServerAdmin xxx@xxx.com
DocumentRoot /var/www/beta
</VirtualHost>
然后启用 a2ensite theta.conf and beta.conf
重启 apache
于是我在 theta.xxx.com and beta.xxx.com 都出现了 cloudflare 的 521 错误!
是哪里少设定了呀?
顺提
我 curl http://我这台服务器IP时
出现的是 403 错误
結果是因為 cloudflare 的 DNS 導致⋯
請先移除 cf 的 DNS,先在 linode DNS 設定
當申請好 SSL 再開啟 CF(不知道為啥必須這樣)