我有一个可以处理的应用程序: http://XXXXX.it:8080/calendar
但是我需要将其重定向到 https _ // XXXX.it/calendar
我安装了apache2并在上面添加了证书。
此处的信息:
etc / apache2 / site-available / 000-default.conf
NameVirtualHost *:80
NameVirtualHost *:8080
<VirtualHost *:80 *:8080>
ServerName calendar.XXXXX.it
DocumentRoot "/var/www/html"
SSLEngine on
SSLCertificateFile /etc/ssl/private/XXXXXit.crt
SSLCertificateKeyFile /etc/ssl/private/p-key.key
SSLCACertificateFile /etc/ssl/private/XXXXXit-chain.crt
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite HIGH:!aNULL:!MD5
Redirect permanent / https://calendar.XXXXX.it/
</VirtualHost>
etc / apache2 / site-available / default-ssl.conf
# NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/private/XXXXXit-chain.crt
SSLCertificateKeyFile /etc/ssl/private/p-key.key
SSLCertificateChainFile /etc/ssl/private/XXXXXXit.crt
<Directory /var/www/html>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Directory>
DocumentRoot /var/www/html
ServerName 10.160.10.101
# ServerName calendar.lantechlongwave.it
ProxyPass /calendar http://localhost:8080/calendar
ProxyPassReverse /calendar http://localhost:8080/calendar
ProxyPass http://calendar.XXXXXX.it:8080/calendar https://calendar.XXXX.it/calendar
ProxyPassReverse http://calendar.XXXXXX.it:8080/calendar https://calendar.XXXXX.it/calendar
ProxyPass /old/calendar http://localhost:8080/old/calendar
ProxyPassReverse /old/calendar http://localhost:8080/old/calendar
ProxyPass /socket.io http://localhost:8080/socket.io
ProxyPassReverse /socket.io http://localhost:8080/socket.io
</VirtualHost>
/etc/apache2/sites-enabled/000-default.conf
#Listen 443
Listen 80
#Listen 8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/apache2/mods-enabled/proxy.conf
<IfModule mod_proxy.c>
# If you want to use apache2 as a forward proxy, uncomment the
# 'ProxyRequests On' line and the <Proxy *> block below.
# WARNING: Be careful to restrict access inside the <Proxy *> block.
# Open proxy servers are dangerous both to your network and to the
# Internet at large.
#
# If you only want to use apache2 as a reverse proxy/gateway in
# front of some web application server, you DON'T need
# 'ProxyRequests On'.
ProxyRequests On
<Proxy *>
AddDefaultCharset off
Require all denied
Require local
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#ProxyVia Off
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/apache2/sites-available/forward_proxy.conf
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ProxyRequests On
ProxyVia On
<Proxy "*">
Require ip 10.101
</Proxy>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error_forward_proxy.log
CustomLog ${APACHE_LOG_DIR}/access_forward_proxy.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
但是不起作用,因为如果我将URL http://XXXXX.it:8080/calendar放在浏览器中,它们将在http中工作并且不会在https上转发。 如果我尝试放下https://XXXXX.it/calendar,它们将不起作用!