A
A
Alexander2015-05-27 18:43:58
PHP
Alexander, 2015-05-27 18:43:58

Https for the site, how to enable?

Ordered a certificate, sent, installed.
The question is how to enable it by default for everyone? those. when you go through http - tossed to https?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Luponos, 2015-05-27
@Bessome

apache or nginx? ? ?
apache: Redirect / https://example.com/( help.ubuntu.ru/wiki/apache_%D0%B8_https )
nginx

server {
  listen *:80;
  server_name example.com;
  proxy_set_header Host example.com;
  location / {
    rewrite ^(.*)$ https://example.com$1 permanent;
  }
}
server {
  listen *:443;
  server_name example.com;
  proxy_set_header Host example.com;
  location / {
    proxy_pass http://127.0.0.1:8080;
  }
}

N
Nikolay, 2015-05-27
@iNickolay

Another option is to add a port check in the index.php file

if($_SERVER['SERVER_PORT'] != 443) {
  header('Location: https://' . $_SERVER['SERVER_NAME']);
}

(provided that you did not change the port, otherwise - specify your own)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question