Tynael / neutrondev-dot-com-comments

1 stars 0 forks source link

how-to-set-up-ssl-certificate-localhost-xampp/ #3

Open utterances-bot opened 5 months ago

utterances-bot commented 5 months ago

How to Set Up an SSL Certificate in Localhost for XAMPP

Learn step-by-step how to set up a self-signed SSL certificate on localhost using XAMPP, Apache and OpenSSL. You'll be ready in a few minutes. [VIDEO]

https://neutrondev.com/how-to-set-up-ssl-certificate-localhost-xampp/

natirivero commented 5 months ago

Can I create multiple certificates for multiple projects following this tutorial? It seems like every certificate is unique so it would not be a problem for windows, but the lines below about Xampp/Apache config make me doubt about it working for different projects:

SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateKeyFile "conf/ssl.key/server.key"

Tynael commented 5 months ago

@natirivero You'll have to generate a certificate for each project and store the certificates in different folders.

Then, in xampp/apache/conf/extra/httpd-vhosts.conf for every project within the same Apache server, you'll have to specify the correct path for SSLCertificateFile & SSLCertificateKeyFile.

# First Project

<VirtualHost *:<your-port>>
    ServerName <your-domain>
    ServerAlias<your-domain>
    DocumentRoot "C:/xampp/htdocs/first-project/public"
</VirtualHost>

<VirtualHost *:<your-port>>
    ServerName <your-domain>
    ServerAlias <your-domain>
    DocumentRoot "C:/xampp/htdocs/first-project/public"
    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/first-project/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/first-project/server.key"
</VirtualHost>

# Second Project
# Third Project and so on...

Hope this helps 🙌

natirivero commented 5 months ago

How can I stored them in different folders? Because I think it looks for these files to be able to generate de cert. To try I delete ssl.crt, ssl.csr and ssl.key and this didn't auto-generate, I had to restore them.

I guess I could duplicate the existing ones and rename the copy, then update httpd-vhosts.conf to look for the new copy, and generate a new cert with the original files?

Regards,

Nat.

El El vie, 23 de feb. de 2024 a la(s) 4:07 p. m., Carol Pelu < @.***> escribió:

@natirivero https://github.com/natirivero You'll have to generate a certificate for each project and store the certificates in different folders.

Then, in xampp/apache/conf/extra/httpd-vhosts.conf for every project within the same Apache server, you'll have to specify the correct path for SSLCertificateFile & SSLCertificateKeyFile.

First Project

<VirtualHost *:> ServerName ServerAlias DocumentRoot "C:/xampp/htdocs/first-project/public"

<VirtualHost *:> ServerName ServerAlias DocumentRoot "C:/xampp/htdocs/first-project/public" SSLEngine on SSLCertificateFile "conf/ssl.crt/first-project/server.crt" SSLCertificateKeyFile "conf/ssl.key/first-project/server.key"

Second Project

Third Project and so on...

Hope this helps 🙌

— Reply to this email directly, view it on GitHub https://github.com/Tynael/neutrondev-dot-com-comments/issues/3#issuecomment-1961990131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP2Q274JJYYERC5SXLKM7M3YVEAJNAVCNFSM6AAAAABDXJC3VKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRRHE4TAMJTGE . You are receiving this because you were mentioned.Message ID: @.***>

Tynael commented 5 months ago

I guess I could duplicate the existing ones and rename the copy, then update httpd-vhosts.conf to look for the new copy, and generate a new cert with the original files?

Yep

Highbee4u commented 1 week ago

Hi @Tynael

I have followed this tutorial and everything was successful. However my site is still showing not secure.

I have changed my port to 8085 and have added it to the vhost. Do I need to add the port to it when creating the certificate?

I mean the "Common name" part because that seems the part I am not sure of.

Tynael commented 2 days ago

Hey @Highbee4u 👋 You don't have to add the port to the "Common name" field when creating the certificate. Because the certificate is self-signed, some browsers still show the site as insecure. Have you tried accessing your site through other browsers? A Chrome-based browser (i.e. Google Chrome, Brave, or Edge) should work fine.