Wpis z mikrobloga

Mirki jak zrobić automatyczne przekierowanie z http do https? Oczywiście jako #cebula korzytsam z darmowego ssl od cloudflare.

server {
listen 80;
server_name ~^(.*)\.xd\.pl$ ;

charset utf-8;
root /var/www/xd/public;
access_log /var/www/xd/app/storage/logs/access.log;
error_log /var/www/xd/app/storage/logs/error.log;
rewrite_log on;
index index.php;

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# PHP FPM configuration.
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location / {
try_files $uri $uri/ index.php?$query_string;
}
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
# deny access to .htaccess files
location ~ /\.ht {
deny all;
}
# Set header expirations on per-project basis
location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
expires 365d;
}

}

Sposoby znalezione na google powodują "ERRTOOMANY_REDIRECTS"
To ma działać tak (dla wszystkich sub domen):
http://xd.xd.pl ---> https://xd.xd.pl
A nie:
http://xd.xd.pl ---> https://xd.pl

#programowanie #nginx
  • 1
  • Odpowiedz
  • Otrzymuj powiadomienia
    o nowych komentarzach