【发布时间】:2018-10-13 14:54:06
【问题描述】:
我在 ubuntu 16.04 中运行 NodeJs 应用程序,我希望请求:http:// 和 http://www 重定向到 https://www。
我尝试通过像这样编辑/etc/apache2/sites-available/000-default.conf 来实现这一点:
<VirtualHost *:80>
ServerAdmin admin@example.net
ServerName www.example.net
ServerAlias example.net www.example.net
ErrorLog /var/log/apache2/mysite-error_log
TransferLog /var/log/apache2/mysite-access_log
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.net$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule (.+) http://www.example.net$1 [R=301,L]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
注意:这里是 example.net,我正在写我的域。
【问题讨论】:
标签: node.js apache ubuntu apache2