Because the company project has to use the link to HTTPS, to get a certificate, after configuration, HTTPS can be normal access, but the previous HTTP is a 400 error, nginx configuration is as follows:
The code is as follows |
Copy Code |
server { Listen default backlog=2048; Listen 443; server_name 111cn.net; root/var/www/html; SSL on; SSL_CERTIFICATE/USR/LOCAL/TENGINE/SSLCRT/111CN.NET.CRT; Ssl_certificate_key/usr/local/tengine/sslcrt/111cn.net.key; } |
When HTTP is accessed, the error is as follows:
Bad Request
The plain HTTP Requset is sent to HTTPS port. Sorry for the inconvenience.
Please and include the following information to us.
Thank you very much!
It is said that the HTTP request was sent to the HTTPS port, which is why this problem occurs. Then this is not very pit,,, I just part of the need for HTTPS, but in this way, the HTTP link can not be used, and then the query data to adjust the configuration file as follows:
code is as follows |
copy code |
Server { Listen default backlog=2048; listen 443 SSL; server_name 111cn.net; root/var/www/html; ssl_certificate/usr/local/tengine/sslcrt/ 111CN.NET.CRT; ssl_certificate_key/usr/local/tengine/ Sslcrt/111cn.net.key; } |
Put SSL on; this line is removed and SSL is written behind port 443. So that the HTTP and HTTPS links can be used, the perfect solution.