我正在将Ubuntu 18.04与Apache 2.4.29配合使用,并且在我的/etc/apache2/sites-available/mywebsitename.conf
文件中,我具有:
<VirtualHost *:80>
ServerName mywebsitename.com
ServerAlias www.mywebsitename.com
ServerAdmin admin@email.com
DocumentRoot /var/www/mywebsitename.com/current/public
<Directory /var/www/mywebsitename.com/current/public>
AllowOverride all
Options -MultiViews
# Uncomment this if you're on Apache > 2.4:
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName mywebsitename.com
DocumentRoot /var/www/mywebsitename.com/current/public
<Directory /var/www/mywebsitename.com/current/public>
AllowOverride all
Options -MultiViews
</Directory>
SSLEngine on
SSLOptions +StrictRequire
SSLCertificateFile /etc/ssl/certs/mywebsitename_com/mywebsitename_com.crt
SSLCertificateKeyFile /etc/ssl/certs/mywebsitename_com/mywebsitename.key
SSLCertificateChainFile /etc/ssl/certs/mywebsitename_com/bundle.crt
</VirtualHost>
我的问题是:<VirtualHost *:80>
继承的<VirtualHost *:443>
中声明的指令吗?也就是说,ServerAlias www.mywebsitename.com
中声明的指令Require all granted
和<VirtualHost *:80>
是否也对<VirtualHost *:443>
有效?
我要问这个是为了纪念DRY principle。我发现:
关于Apache配置的任何建议吗?