не перенаправляются запросы на index.php в https apache
Вот файл конфига сайта.
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName test.ru
RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}
</VirtualHost>
<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 test.ru
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.ru
# 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}/test.ru.error.log
CustomLog ${APACHE_LOG_DIR}/test.ru.access.log combined
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /home/cf/ssl/test.ru.pem
SSLCertificateKeyFile /home/cf/ssl/test.ru.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
# 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>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
А вот htaccess
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ /index.php
мне надо чтобы все запросы направлялись на /index.php по https протоколу. но у меня не получается настроить.
Вот я пытаюсь подключиться к /install, по идее он должен перенаправить на /index.php запрос, но он этого не делает.
* TCP_NODELAY set
* Connected to brokenheads.ru (127.0.0.1) port 80 (#0)
> GET /install HTTP/1.1
> Host: brokenheads.ru
> User-Agent: curl/7.65.3
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Date: Mon, 24 Feb 2020 12:10:59 GMT
< Server: Apache/2.4.41 (Ubuntu)
< Location: https://brokenheads.ru
< Content-Length: 286
< Content-Type: text/html; charset=iso-8859-1
<
* Ignoring the response-body
{ [286 bytes data]
100 286 100 286 0 0 279k 0 --:--:-- --:--:-- --:--:-- 279k
* Connection #0 to host brokenheads.ru left intact
* Issue another request to this URL: 'https://brokenheads.ru/'
* Trying 127.0.0.1:443...
* TCP_NODELAY set
* Connected to brokenheads.ru (127.0.0.1) port 443 (#1)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [25 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [1060 bytes data]
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
} [2 bytes data]
* SSL certificate problem: self signed certificate
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Closing connection 1
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Ответы (1 шт):
Автор решения: sanmai
→ Ссылка
У вас стоит проверка на модуль SSL, который не включен по умолчанию. Включить можно так:
sudo a2enmod ssl