есть 2 сайта, вот их конфиги
upstream node {
server 127.0.0.1:8080 fail_timeout=20s;
}
server {
server_name site1.com;
return 301 https://$server_name$request_uri;
}
server {
server_name site1.com www.site1.com;
listen 443 ssl;
ssl on;
ssl_certificate /var/www/site1.com/ssl/certificate.pem;
ssl_certificate_key /var/www/site1.com/ssl/key.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "RC4:HIGH:!aNULL:!MD5:!kEDH";
add_header Strict-Transport-Security 'max-age=604800';
root /var/wwwsite1.com/public;
index index.php index.html index.htm;
rewrite ^/(.*)/$ /$1 permanent;
access_log /var/log/nginx/site1.com.access.log;
error_log /var/log/nginx/site1.com.error.log;
location /ws {
proxy_pass http://node;
proxy_http_version 1.1;
proxy_set_header Upgrade websocket;
proxy_set_header Connection upgrade;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
client_max_body_size 300m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
и сайт 2
server {
server_name site2.com;
return 301 https://$server_name$request_uri;
}
server {
server_name site2.com ;
listen 443 ssl;
ssl on;
ssl_certificate /var/www/html/ssl/certificate.pem;
ssl_certificate_key /var/www/html/ssl/key.key;
root /var/www/html/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
если вбить
https://site1.com то все работает правильно, но если в браузерную строку просто вставить site1.com происходит редирект на site1.com
PS: site1.com пущен через cloudflare