openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost.key -out /etc/ssl/certs/localhost.crt -config localhost.cnf
[ req ]
default_bits = 2048
default_md = sha256
prompt = no
distinguished_name = dn
x509_extensions = v3_req
[ dn ]
CN = localhost
[ v3_req ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = localhost
Nginx
server {
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name localhost;
ssl_certificate /etc/ssl/certs/localhost.crt;
ssl_certificate_key /etc/ssl/private/localhost.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
#root /var/www/gif84;
root /var/www/wp;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
client_max_body_size 256M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Open the Certificate Manager:
Press Win + R, type mmc.exe, and press Enter.
Go to File > Add/Remove Snap-in.
Select Certificates and click Add.
Choose Computer account and click Next.
Select Local computer and click Finish.
Click OK to close the Add/Remove Snap-in window.
In the Certificate Manager, expand Certificates (Local Computer).
Navigate to Trusted Root Certification Authorities > Certificates.
Right-click on Certificates, select All Tasks > Import.
Follow the Certificate Import Wizard to import your localhost.crt file.
After importing the certificate, restart your browser