I got a certificate. Installed BitrixVM 5.1.5 . C cert.pem and private.key . I put them in /etc/nginx/ssl/1/ then in /etc/nginx/bx/conf/ssl.conf registered ssl_certificate /etc/nginx/ssl/1/cert.pem; and ssl_certificate_key /etc/nginx/ssl/1/private.key; further restarted nginx. Then deployed from the cloud 1c backup site. when you access the site via https:// redirects to http:// and if you try to open https://mysite.com/bla-bla/chto_ygodno/ will open http://mysite.com/
I immediately thought that BitrixVM should support the work of port 80 and 443 at the same time, looked at the nginx configs and found nothing unusual.
Conclusion: probably the problem is in the site, but below I will also present nothing not surprised. .htaccess And on this my ideas are over, help, tell me where to look for this notorious redirect, I will be very grateful to you, below are the configs.
.htaccess
Options -Indexes ErrorDocument 404 /404.php <IfModule mod_php5.c> php_flag session.use_trans_sid off php_value auto_prepend_file "/home/bitrix/ext_www/mysite.com/bitrix/modules/security/tools/start.php" php_value display_errors 0 #php_value mbstring.internal_encoding UTF-8 </IfModule> <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$ Redirect 301 /shop/zapchasti/ /shop/tovari/dlya_pitbaykov/ RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L] RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] </IfModule> <IfModule mod_dir.c> DirectoryIndex index.php index.html </IfModule> <IfModule mod_expires.c> ExpiresActive on ExpiresByType image/jpeg "access plus 3 day" ExpiresByType image/gif "access plus 3 day" ExpiresByType image/png "access plus 3 day" ExpiresByType text/css "access plus 3 day" ExpiresByType application/javascript "access plus 3 day" </IfModule> /etc/nginx/bx/site_avaliable/
bx_ext_mysite.com.conf
server { listen 80 ; server_name mysite.com www.mysite.com; access_log /var/log/nginx/mysite_access.log main; error_log /var/log/nginx/mysite_error.log warn; #charset utf-8; server_name_in_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:80; set $proxyserver "http://127.0.0.1:8887"; set $imcontenttype "text/html; charset=utf-8"; set $docroot "/home/bitrix/ext_www/mysite.com"; index index.php; root "/home/bitrix/ext_www/mysite.com"; # Redirect to ssl if need if (-f /home/bitrix/ext_www/mysite.com/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; } # Include parameters common to all websites include bx/conf/bitrix.conf; # Include munin and nagios web include bx/server_monitor.conf; } bx_ext_ssl_mysite.com.conf
server { listen 443 ssl; server_name mysite.com www.mysite.com; # enable SSL connection include bx/conf/ssl.conf; access_log /var/log/nginx/mysite_access.log main; error_log /var/log/nginx/mysite_error.log warn; #charset utf-8; server_name_in_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:443; proxy_set_header HTTPS YES; proxy_set_header X-Forwarded-Proto https; set $proxyserver "http://127.0.0.1:8887"; set $imcontenttype "text/html; charset=utf-8"; set $docroot "/home/bitrix/ext_www/mysite.com"; index index.php; root "/home/bitrix/ext_www/mysite.com"; # Include parameters common to all websites include bx/conf/bitrix.conf; # Include munin and nagios web include bx/server_monitor.conf; } Of course, instead of mysite.com, my domain for which the certificate was purchased.
I really hope for your ingenuity and I will be glad to any hints in search of this redirect.
Maybe there is some way to look at the logs that causes a redirect, which I do not know?)
nginx→apache→phpconstruction. It will be logical: 1. all the processing associated with https, leave nginx-y. 2. apache "do not touch" - let them think that it works using the http protocol. 3. Encourage php not to return any redirects to either http or https. good luck - aleksandr barakin