谷歌计算引擎Apache2子域仍然指向一个主文件夹,而不是虚拟主机文件夹
我一直在尝试在我的谷歌云控制台中创建子域,然后将它们指向我的/var/www目录中的一个文件夹 我创建了一个子域:谷歌计算引擎Apache2子域仍然指向一个主文件夹,而不是虚拟主机文件夹,apache2,subdomain,virtualhost,Apache2,Subdomain,Virtualhost,我一直在尝试在我的谷歌云控制台中创建子域,然后将它们指向我的/var/www目录中的一个文件夹 我创建了一个子域: DNS Name: subdomain.example.com Type: CNAME TTL: 300 Data: example.com 我创建了一个文件夹 /var/www/subdomain 我创建了一个带有消息“Subdomain!” /var/www/subdomain/index.html 之后,我复制了我的000-default.conf cp /etc/apac
DNS Name: subdomain.example.com
Type: CNAME
TTL: 300
Data: example.com
我创建了一个文件夹
/var/www/subdomain
我创建了一个带有消息“Subdomain!”
/var/www/subdomain/index.html
之后,我复制了我的000-default.conf
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/subdomain.conf
我将新文件代码编辑为:
<VirtualHost *:80>
ServerAdmin webmaster@subdomain.example.com
DocumentRoot /var/www/subdomain
ServerName subdomain.example.com
ServerAlias www.subdomain.example.com
Redirect permanent / https://subdomain.example.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
然而,我的子域仍然指向文档根/var/www/html
我注意到,当我执行systemctl重新加载apache2
时,我得到错误无法连接到总线:没有这样的文件或目录
我是否错过了一个步骤或需要添加其他内容?问题是http已配置,但未配置https 必须添加到默认的ssl.conf
<VirtualHost *:443>
ServerName www.yoursite.com
DocumentRoot /var/www/site
SSLEngine on
SSLCertificateFile /path/to/www_yoursite_com.crt
SSLCertificateKeyFile /path/to/www_yoursite_com.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>
服务器名www.yoursite.com
DocumentRoot/var/www/site
斯伦金安
SSLCertificateFile/path/to/www\u yoursite\u com.crt
SSLCertificateKeyFile/path/to/www_yoursite_com.key
SSLCertificateChainFile/path/to/DigiCertCA.crt
<VirtualHost *:443>
ServerName www.yoursite.com
DocumentRoot /var/www/site
SSLEngine on
SSLCertificateFile /path/to/www_yoursite_com.crt
SSLCertificateKeyFile /path/to/www_yoursite_com.key
SSLCertificateChainFile /path/to/DigiCertCA.crt
</VirtualHost>