400 Bad Request The plain HTTP request was sent to HTTPS port
-
I have a wordpress installation and trying to get to
http://localhost
and it gives me this error:My wordpress config file is as follows:
server { # Listen on all network interfaces on port 80 listen 80; # Listen on port 443 using SSL and make it the default server listen 443 default_server ssl; # Specify the path of your .crt and .key files ssl on; ssl_certificate /etc/ssl/private/localhost.crt; ssl_certificate_key /etc/ssl/private/localhost.key; # Enable session caching, increase session timeout ssl_session_cache shared:SSL:20m; ssl_session_timeout 60m; # Disable SSL in favor of TLS (safer) ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Specify the host name(s) that will match the site # The following value allows both www. and no subdomain server_name geeky; # Set the path of your WordPress files root /home/wordpress/www; # Automatically load index.php index index.php; # Saves client request body into files, cleaning up afterwards client_body_in_file_only clean; client_body_buffer_size 32K; # Allow uploaded files up to 300 megabytes client_max_body_size 300M; # Automatically close connections if no data is # transmitted to the client for a period of 10 seconds send_timeout 10s; # The rest of the configuration (location blocks) # is found below # The following applies to static files: # images, CSS, javascript location ~* ^.+.(jpg|jpeg|png|gif|ico|css|js)$ { access_log off; # Disable logging # Allow client browsers to cache files # for a long period of time expires 180d; } # The following applies to every request location / { # Try serving the requested URI: # - If the file does not exist, append / # - If the directory does not exist, # redirect to /index.php forwarding the request URI # and other request arguments try_files $uri $uri/ /index.php?q=$uri&$args; } # The following applies to every PHP file location ~ .php$ { # Ensure file really exists if (!-e $request_filename) { return 404; } # Pass the request to your PHP-FPM backend fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/wordpress/www$fastcgi_script_name; include fastcgi_params; } }
The /var/log/nginx/error.log is empty.
btw, https://localhost works fine.
-
@mountaing this is because you have the option
ssl on
it always tries to use SSL for the connection. also I guess you are using a version older than 1.15.0, because check the nginx documentation: https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl
For the ssl option.This directive was made obsolete in version 1.15.0. The ssl parameter of the listen directive should be used instead.
If you are trying to use both http(80) and https(443) on the same site, just turn off the option.
ssl on;
Comment it out, remove it, or change it to
ssl off;
-
@saolasosme You were right! Changing that option to off made it work. yeah I'll keep tabs on the version changes, thanks for the tip!
© Lightnetics 2024