LINUX.ORG.RU

Не удается отключить https для www.sitename.ru

 ,


0

1

Приветствую.

Есть сайт, для которого надо отключить https и переключить на http. Зачем - это не ко мне. Сайт на базе Битрикс, в виртмашине Битрикса. Через меню управления виртмашиной https отключен, в админке перенаправление на https отключено. Также закомментарены настройки для ssl.

Удалось добиться нормального открытия http://sitename.ru. А вот при открытии http://www.sitename.ru. выдается сообщение об ошибке: «404 Not Found. nginx/1.10.1» и постоянно норовит на https переключиться.

Подскажите, пожалуйста, что еще можно настроить или поправить. Если надо, могу предоставить еще конфиги.

P.S. К сожалению, что-то у меня lorcode не работает.

Владимир.

nginx.conf


user bitrix;
worker_processes 8;

error_log /var/log/nginx/error.log crit;

pid /var/run/nginx.pid;
worker_rlimit_nofile 20480;

events {
	use epoll;
	worker_connections  10240;
	multi_accept on;
}

http {

	include /etc/nginx/mime.types;
	default_type application/force-download;
	server_names_hash_bucket_size 128;

	# Description of supported access log formats
	log_format main	'$remote_addr - $remote_user [$time_local - $upstream_response_time] '
                  '$status "$request" $body_bytes_sent '
                  '"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';

	log_format common '$remote_addr - - [$time_local - $upstream_response_time] '
                    '"$request" $status $bytes_sent '
                    '"$http_referer" "$http_user_agent" $msec';

  log_format balancer '$remote_addr - $remote_user [$time_iso8601] "$host" '
                    '"$request" $status $body_bytes_sent "schema: $scheme" '
                    '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" '
                    '"$request_length" : "$request_time" -> $upstream_response_time';

	log_format debug '$upstream_response_time,"$time_local","$remote_addr","$request",$status,$body_bytes_sent';

	#access_log /var/log/nginx/access.log main buffer=16k;

	# Caches information about open FDs, freqently accessed files.
	open_file_cache max=200000 inactive=20s; 
	open_file_cache_valid 30s; 
	open_file_cache_min_uses 2;
	open_file_cache_errors on;


	# upload default maps
	include bx/maps/*.conf;

	sendfile			on;
	tcp_nopush			on;
	tcp_nodelay			on;

	# Timeout for keep-alive connections. Server will close connections after this time.
	keepalive_timeout 30;
	# Number of requests a client can make over the keep-alive connection.
	keepalive_requests 1000;

	# Allow the server to close the connection after a client stops responding. 
	reset_timedout_connection on;

	# Send the client a "request timed out" if the body is not loaded by this time.
	client_body_timeout 10;
	# If the client stops reading data, free up the stale client connection after this much time.
	send_timeout 2;

	client_max_body_size		1024m;
	client_body_buffer_size		4m;

	# Parameters for back-end request proxy
	proxy_connect_timeout		600;
	proxy_send_timeout		600;
	proxy_read_timeout		600;
	proxy_buffer_size		64k;
	proxy_buffers			8 256k;
	proxy_busy_buffers_size		256k;
	proxy_temp_file_write_size	10m;

	# Assign default error handlers
	error_page 500 502 503 504 /500.html;
	error_page 404 = /404.html;


	# Compression.
	gzip on;
	gzip_min_length 10240;
	gzip_proxied expired no-cache no-store private auth;
	gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
	gzip_disable "msie6";

	# Content compression parameters
	#gzip				on;
	#gzip_proxied			any;
	#gzip_static			on;
	#gzip_http_version		1.0;
	#gzip_types			application/x-javascript application/javascript text/css;

	add_header "X-Content-Type-Options" "nosniff";
	add_header X-Frame-Options SAMEORIGIN;
	# add_header X-Frame-Options ALLOW-FROM https://analytics.google.com;

	# Set nginx-push-stream-module common parameters
	include bx/conf/im_settings.conf;


	# Set default website
	include bx/site_enabled/*.conf;

	# Set additional websites
	include bx/site_ext_enabled/*.conf;

	#server {
	#	if ($http_referer !~* ^($|http://|https://) ){
     	#	return 403;
	#	}

	server {
    	listen *:80;
   	server_name www.sitename.ru;
	}

}

bx/site_enabled/s1.conf


	# Default website
	server {

		listen 80 default_server;
		server_name _;
		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;

		set $proxyserver	"http://127.0.0.1:8888";
		set $docroot		"/home/bitrix/www";

		index index.php;
		root /home/bitrix/www;

# 13.07.2017
		# Redirect to ssl if need
#		if (-f /home/bitrix/www/.htsecure) { rewrite ^(.*)$ https://$host$1 permanent; }
#		if ($host = 'www.sitename.ru' ) {
# 		         rewrite  ^/(.*)$  https://sitename.ru/$1  permanent;
#		}

#        if ($host = 'https://www.sitename.ru' ) {
#                 rewrite  ^/(.*)$  https://sitename.ru/$1  permanent;
#        }


#        if ($host = 'http://www.sitename.ru' ) {
#                 rewrite  ^/(.*)$  http://sitename.ru/$1  permanent;
#        }

		# Include parameters common to all websites
		include bx/conf/bitrix.conf;

		# Include server monitoring locations
		include bx/server_monitor.conf;
	}



Последнее исправление: leave (всего исправлений: 3)

Твоя простыня нечитаема. Осиль LORCODE или залей конфиг на пастбин.

А потом загугли, что такое HSTS - скорее всего это решение твоей проблемы.

l0stparadise ★★★★★
()
Ответ на: комментарий от l0stparadise

Удваиваю hsts, были проблемы когда браузерня слепо лезла в https не по делу, после после первого редиректа по делу.

FeyFre ★★★★
()
Ответ на: комментарий от l0stparadise

HSTS - это возможная причина проблемы, а не решение. HSTS загловок интструктирует браузеры использовать HTTPS для домена принудительно до истечения срока действия

annulen ★★★★★
()
Последнее исправление: annulen (всего исправлений: 1)
Ответ на: комментарий от annulen

Если у сервера отключить hsts-заголовки и в браузере почистить hsts-таблицу, то браузер успешно всё забывает и до истечения срока.

imul ★★★★★
()
Ответ на: комментарий от annulen

Да, у каждого. Или всем заходить из нового профиля.
Или отключить заголовки сейчас, а https убрать когда время указанное в заголовке hsts истечёт.

imul ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.