Всем привет, не хотят работать редиректы с http на https, выдает 403 ошибку. Debian 10 nginx/1.14.2 Обычная конфигурация без заморочек, только proxypass.
nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
один из типовых конфигов из папки conf.d:
server {
server_name pod.example.com;
listen 80;
listen [::]:80;
error_log /var/log/nginx/zabbix.log debug;
access_log /var/log/nginx/zabbix.log;
return 301 https://$host$request_uri;
}
server {
server_name pod.example.com;
listen 443 ssl http2;
listen [::]:443 ssl http2;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
error_log /var/log/nginx/zabbix.log;
access_log /var/log/nginx/zabbix.log;
ssl on;
ssl_certificate /etc/nginx/certs/bundle.crt;
ssl_certificate_key /etc/nginx/certs/pod.example.com.key;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_pass http://192.168.10.9/zabbix/;
proxy_set_header Cookie $http_cookie;
proxy_cookie_path /zabbix /;
}
}
Так же пробовал такой тип редиректа:
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
error.log:
2020/09/28 10:37:48 [error] 20904#20904: *82083 access forbidden by rule, client: 87.252.246.114, server: 192.168.10.9, request: "GET / HTTP/1.1", host: "pod.example.com"
2020/09/28 10:37:48 [error] 20904#20904: *82083 access forbidden by rule, client: 87.252.246.114, server: 192.168.10.9, request: "GET /favicon.ico HTTP/1.1", host: "pod.example.com", referrer: "http://pod.example.com/"
Пробовал прописывать в редиректе статично домен, но ничего не помогает. На прописанные редиректы вообще никак не реагирует. Если заходить прямо на https://pod.example.com все будет работать. Заранее спасибо.