Today in the configuration of the Nginx+ssl when the title of the mistake, and later with the Niang a bit of sex after finding a solution, quite useful, conveniently turned.
Generally in the configuration of Vhost will have PHP parsing a paragraph, such as:
Copy Code code as follows:
Location ~. *\. (PHP|PHP5)? $
{
Try_files $uri = 404;
Fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_param HTTPS $https If_not_empty;
Fastcgi_index index.php;
Include fcgi.conf;
}
Explain:
Many people think that using Fastcgi_param HTTPS on;
This is true, but forcing the use of this parameter is not very effective!
The best answer is Fastcgi_param HTTPS $https if_not_empty; (Refer to the official link below Nginx), the HTTPS protocol is used to automatically use HTTPS on, otherwise the Fastcgi_param HTTPS parameter is ignored.
Embedded variables:
$https – returns "on" if the link is SSL, otherwise an empty string is returned.
If_not_empty; – passed to the server when the parameter has a value
Note: This method is only suitable for versions after Nginx 1.1.11
Reference:
stackoverflow/nginx#1/nginx#2