: Nginx http to https redirect - just isn't working I am running my own webserver with nginx on ubuntu 17.10. I have opened ports 80 and 443. Trying to get the HTTP to HTTPS redirect working,
I am running my own webserver with nginx on ubuntu 17.10. I have opened ports 80 and 443.
Trying to get the HTTP to HTTPS redirect working, but everthing i seem to have tried fails. i am still getting the 400 Bad Request The plain HTTP request was sent to HTTPS port error when i navigate directly to the http site.
Hoping someone can spot the issue in my nginx config file.
server {
listen 80;
listen [::]:80;
server_name example.com example.com; return 301 example.com$request_uri; }
server {
listen 443 ssl; # managed by Certbot
listen [::]:443 ssl http2; # managed by Certbot
server_name example.com example.com; ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
root /var/www/html/wordpress;
index index.php index.html index.htm;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Deny access to .htaccess files, if Apache's document
# root concurs with nginx's one
location ~ /.ht {
deny all;
}
location ^~ /.well-known/acme-challenge/ {
auth_basic off;
autoindex on;
}
}
More posts by @Hamm4606531
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.