After configuring the SSL certificate for Nginx, HTTPS can be accessed normally, HTTP access shows a 400 error, and Nginx configuration is as follows:
server {listen 80 default backlog=2048;listen 443;server_name lvtao.net;root /var/www/html;ssl on;ssl_certificate /usr/local/Tengine/sslcrt/lvtao.net.crt;ssl_certificate_key /usr/local/Tengine/sslcrt/lvtao.net.key;}
When HTTP is accessed, the error is as follows:
400 Bad RequestThe plain HTTP requset was sent to HTTPS port. Sorry for the inconvenience.Please report this message and include the following information to us.Thank you very much!
The HTTP request is sent to the HTTPS port, so this problem occurs.
server {listen 80 default backlog=2048;listen 443 ssl;server_name lvtao.net;root /var/www/html;ssl_certificate /usr/local/Tengine/sslcrt/lvtao.net.crt;ssl_certificate_key /usr/local/Tengine/sslcrt/lvtao.net.Key;}
Put SSL on; this line is removed and SSL is written behind port 443. This way HTTP and HTTPS links can be used, the perfect solution.
HTTP and HTTPS simultaneous access methods in Nginx environment