Приложения HTTPS GWT в Apache и Tomcat EE
Я хотел бы узнать, как правильно настроить Apache2 и Tomcat (TomEE)/8.5.6 (7.0.2) для приложения GWT HTTPS при новой установке Ubuntu Server 16.04.3.
Вот шаги, которые я использовал.
Настроил мои записи DNS.
Проверил настройку Apache.
$ sudo apache2ctl -S VirtualHost configuration: *:80 zethanath.tk (/etc/apache2/sites-enabled/000-default.conf:1) *:443 is a NameVirtualHost default server zethanath.tk (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2) port 443 namevhost zethanath.tk (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2) alias www.zethanath.tk alias servlet.zethanath.tk port 443 namevhost zethanath.tk (/etc/apache2/sites-enabled/default-ssl.conf:2) port 443 namevhost www.zethanath.tk (/etc/apache2/sites-enabled/default-ssl.conf:140) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex rewrite-map: using_defaults Mutex ssl-stapling-refresh: using_defaults Mutex ssl-stapling: using_defaults Mutex proxy: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex watchdog-callback: using_defaults Mutex proxy-balancer-shm: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 Group: name="www-data" id=33
Настроил мой
/etc/apache2/sites-enabled/default-ssl.conf
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName zethanath.tk ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/index// ProxyPassReverse / http://192.168.1.70:8080/index// JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName www.zethanath.tk ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/index// ProxyPassReverse / http://192.168.1.70:8080/index// JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Настроил мой
/etc/apache2/sites-enabled/000-default-le-ssl.conf
<IfModule mod_ssl.c> <VirtualHost *:443> ServerName zethanath.tk ServerAlias www.zethanath.tk servlet.zethanath.tk ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/index// ProxyPassReverse / http://192.168.1.70:8080/index// JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
Настроил мой
/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80 > ServerName zethanath.tk ServerAlias www.zethanath.tk servlet.zethanath.tk ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined #JKMount /* ajp13_worker # 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 RewriteEngine on RewriteCond %{SERVER_NAME} =zethanath.tk RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Обратите внимание, что я установил libapache2-mod-jk
, Содержание моего /etc/hosts
ниже.
127.0.0.1 localhost
127.0.1.1 erick-ASRock-N68C-GS4-FX
192.168.1.70 zethanath.tk
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Для следующих адресов в Firefox я получаю эти результаты. Они правы?
http://zethanath.tk
http://www.zethanath.tk
http://192.168.1.70:8080/index/
http://servlet.zethanath.tk
http://servlet.zethanath.tk Unable to Connect
Что я действительно хочу сделать, так это позволить Apache2 обслуживать мой сертификат, и он должен перенаправить меня на сервер TomEE. Я бы не позволил Apache2 вообще предоставлять какой-либо контент, кроме сертификата. Остальное содержимое должно предоставляться только через приложения GWT (Google Web tool kit). Я думаю, что GWT будет ожидать настройки, как показано ниже, но я не знаю, как это сделать.
Из документов GWT:
Your Apache server is running on www.example.com Your Tomcat server is running on servlet.example.com:8080 Your GWT module has a `<rename-to="myapp">` You have one RPC servlet, mapped into /myapp/myService
Идея состоит в том, чтобы запросить прокси-сервер Apache к сервлету на другой сервер, чтобы:
(http)://www.example.com/MyApp/myapp/myService -> (http)://servlet.example.com:8080/MyApp/myapp/myService
Следующая конфигурация Apache устанавливает такое правило с помощью прокси:
ProxyPass /MyApp/myapp/myService (http)://servlet.example.com:8080/MyApp/myapp/myService ProxyPassReverse /MyApp/myapp/myService (http)://servlet.example.com:8080/MyApp/myapp/myService
Чтобы убедиться, что это работает, используйте веб-браузер, чтобы нажать оба (http)://www.example.com/MyApp/myapp/myService и (http): //servlet.example.com: 8080 / MyApp / myapp / myService,
В обоих случаях вы должны получить один и тот же результат (как правило, метод HTTP GET 405: этот URL не поддерживается, что хорошо). Если при втором URL-адресе появляется что-то другое, возможно, у вас возникли проблемы с конфигурацией.
2 ответа
Следующие шаги решили мою проблему.
sudo nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80 > # 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.zethanath.tk ServerAlias servlet.zethanath.tk zethanath.tk Redirect permanent "/" "https://www.zethanath.tk/" ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/Index/ ProxyPassReverse / http://192.168.1.70:8080/Index/ #ServerAdmin erick9.hi5@gmail.com #DocumentRoot /var/www/html # 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.log CustomLog ${APACHE_LOG_DIR}/access.log combined #JKMount /* ajp13_worker # 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". # 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.log CustomLog ${APACHE_LOG_DIR}/access.log combined #JKMount /* ajp13_worker # 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 RewriteEngine on RewriteCond %{SERVER_NAME} =www.zethanath.tk RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
<IfModule mod_ssl.c> <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.zethanath.tk ServerAlias servlet.zethanath.tk zethanath.tk Redirect permanent "/" "https://www.zethanath.tk/" ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/Index/ ProxyPassReverse / http://192.168.1.70:8080/Index/ #DocumentRoot /var/www/html #JKMount /* ajp13_worker # 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.log CustomLog ${APACHE_LOG_DIR}/access.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 SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
sudo nano /etc/apache2/sites-available/default-ssl.conf
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName www.zethanath.tk ServerAlias servlet.zethanath.tk zethanath.tk Redirect permanent "/" "https://www.zethanath.tk/" ProxyPreserveHost On ProxyPass / http://192.168.1.70:8080/Index/ ProxyPassReverse / http://192.168.1.70:8080/Index/ #DocumentRoot /var/www/html #JKMount /* ajp13_worker # 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.log CustomLog ${APACHE_LOG_DIR}/access.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 # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. # BrowserMatch "MSIE [2-6]" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
$ sudo apache2ctl configtest Синтаксис ОК
$ sudo systemctl перезапустить apache2
Я могу прогрессировать немного дальше. Тем не менее, я до сих пор не понимаю некоторые вещи. Я вставил свои вопросы в конце этой публикации.
Вот шаги, которые я только что сделал.
- Я перенастроил "000-default-le-ssl.conf".
$ sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#DocumentRoot /var/www/html
JKMount /* ajp13_worker
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
<VirtualHost *:443>
ServerName (www).zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#DocumentRoot /var/www/html
JKMount /* ajp13_worker
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
<VirtualHost *:443>
ServerName servlet.zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#DocumentRoot /var/www/html
JKMount /* ajp13_worker
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Я перенастроил "default-ssl.conf". $ sudo nano /etc/apache2/sites-enabled/default-ssl.conf
<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName zethanath.tk ServerAlias zethanath.tk ProxyPreserveHost On ProxyPass / (http)://192.168.1.70:8080/Index// ProxyPassReverse / (http)://192.168.1.70:8080/Index// #DocumentRoot /var/www/html JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName (www).zethanath.tk ServerAlias zethanath.tk ProxyPreserveHost On ProxyPass / (http)://192.168.1.70:8080/Index// ProxyPassReverse / (http)://192.168.1.70:8080/Index// #DocumentRoot /var/www/html JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> <VirtualHost _default_:443> ServerAdmin erick9.hi5@gmail.com ServerName servlet.zethanath.tk ServerAlias zethanath.tk ProxyPreserveHost On ProxyPass / (http)://192.168.1.70:8080/Index// ProxyPassReverse / (http)://192.168.1.70:8080/Index// #DocumentRoot /var/www/html JKMount /* ajp13_worker ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Я перенастроил "000-default.conf".
$ sudo nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80 >
ServerName zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#ServerAdmin erick9.hi5@gmail.com
#DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#JKMount /* ajp13_worker
RewriteEngine on
RewriteCond %{SERVER_NAME} =zethanath.tk
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80 >
ServerName (www).zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#ServerAdmin erick9.hi5@gmail.com
#DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#JKMount /* ajp13_worker
RewriteEngine on
RewriteCond %{SERVER_NAME} =(www).zethanath.tk
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80 >
ServerName servlet.zethanath.tk
ServerAlias zethanath.tk
ProxyPreserveHost On
ProxyPass / (http)://192.168.1.70:8080/Index//
ProxyPassReverse / (http)://192.168.1.70:8080/Index//
#ServerAdmin erick9.hi5@gmail.com
#DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#JKMount /* ajp13_worker
RewriteEngine on
RewriteCond %{SERVER_NAME} =zethanath.tk
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
- Я проверил эти синтаксис конфигурации.
$ sudo apache2ctl configtest Синтаксис ОК
- Я перезапустил свой сервер.
$ sudo systemctl перезапустить apache2
- Теперь, когда я набрал (http)://zethanath.tk, я получил бы следующее.
введите описание изображения здесь
- Теперь, когда я набрал (http)://(www).zethanath.tk, я получил (https) сайт, что я и хочу.
введите описание изображения здесь
- Теперь, когда я набрал (http)://servlet.zethanath.tk, я также получил (https) сайт, что я тоже хочу.
Мои вопросы к тебе.
Что мне нужно сделать, чтобы получить https, когда я набрал (http): //zethanath.tk в браузере?
Как правильно обслуживать (http/https)://servlet.zethanath.tk только за моим маршрутизатором? Я не хочу, чтобы это показывалось за пределами моего роутера.
Спасибо.