Я изменил мой файл конф, так что, когда пользователь в домене без WWW перенаправляет к домену с WWW:Слишком много переадресаций - изменение голой URL -> www.example.com
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
Я также хочу, чтобы мои https для чего-либо под пользователем/
Я получаю ошибку, также может перенаправлять, где я иду не так?
Так у меня есть:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/site;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /user {
rewrite^https://$http_host$request_uri? permanent;
}
}
Для порта 443:
server {
listen 443;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
root /var/www/example.com/site;
index index.html index.htm;
ssl on;
ssl_certificate //path here
ssl_certificate_key //path here
location/{
rewrite^http://$http_host$request_uri? permanent;
}
location /user {
}
}