Nginx configuration file:
server {
listen 80;
listen 443;
server_name www.xxx.com;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
ssl on;
root html;
index index.html index.htm;
ssl_certificate /etc/nginx/conf.d/cert/214567143360012.pem;
ssl_certificate_key /etc/nginx/conf.d/cert/214567143360012.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}
It is normal to access HTTPS, but when accessing HTTP, there will be
400 bad requestthe plain HTTP request was sent to HTTPS port error
A normal HTTP request is sent to the HTTPS port
Referring to the official documents, the solution is as follows:
server {
listen 80;
listen 443 ssl;
server_name www.xxx.com;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
root html;
index index.html index.htm;
ssl_certificate /etc/nginx/conf.d/cert/214567143360012.pem;
ssl_certificate_key /etc/nginx/conf.d/cert/214567143360012.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}
Delete SSL on; And in listen 443; 443 and then add SSL
Similar Posts:
- How to Solve error: NSPOSIXErrorD omain:100
- Nginx normal user startup configuration error: && springboot-swagger & Unable to infer base url
- How to Solve Nginx error: 403 Forbidden
- Nginx Error when installing the startup service failed to start a high performance web server and a reverse proxy serve
- [Solved] nginx no resolver defined to resolve..
- CentOS starts nginx and prompts nginx: [emergency] still could not bind ()
- [Sovled] CentOS nginx 500 error: failed (13: Permission denied)
- Error 500 when opening the site configured by nginx
- Nginx Error: Nginx 403 error:directory index of “xxx“ is forbidden
- [Solved] Nginx Log Error: open() “/opt/Nginx/nginx/nginx.pid” failed (2: No such file or directory)