title: localhost self-signed certificate across LAN in XAMPP
body: <p>I have localhost with ssl and working fine on my local pc but ssl doesn't work across LAN. Because I'm using self-signed certificate I have to install certificate in every PC in which I'll open site but it's only working on PC in which website is hosted but not on other PC on LAN.</p>
  
  <p>I don't want to host my website online because I'm in development mode.</p>
  
  <h1>My Local PC:</h1>
  
  <h3>host file:</h3>
  
  <pre><code>127.0.0.1 gofashion_chat.test
  </code></pre>
  
  <h3>httpd-xampp.conf</h3>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      DocumentRoot "C:/xampp/htdocs/gofashion"
      ServerName gofashion_chat.test
      ServerAlias *.gofashion_chat.test
  &lt;/VirtualHost&gt;
  &lt;VirtualHost *:443&gt;
      DocumentRoot "C:/xampp/htdocs/gofashion"
      ServerName gofashion_chat.test
      ServerAlias *.gofashion_chat.test
      SSLEngine on
      SSLCertificateFile "C:/xampp/htdocs/gofashion/cert/gofashion_chat.test/server.crt"
      SSLCertificateKeyFile "C:/xampp/htdocs/gofashion/cert/gofashion_chat.test/server.key"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <h3>Certificate in browser:</h3>
  
  <p><a href="https://i.stack.imgur.com/NVWH1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NVWH1.png" alt="Certificate in browser"></a></p>
  
  <h1>PC on LAN:</h1>
  
  <h3>host file:</h3>
  
  <pre><code>192.168.10.7 gofashion_chat.test
  </code></pre>
  
  <h3>Certificate in browser on LAN PC:</h3>
  
  <p><a href="https://i.stack.imgur.com/Qh9qQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qh9qQ.png" alt="Certificate in browser on LAN PC"></a></p>
  
  <p>In have installed server.crt on both PC</p>
  
  <p>How do I solve ssl issue across LAN?</p>
  
  <h2>Edit:</h2>
  
  <p>This is my bat file which I used to generate certificate</p>
  
  <pre><code>@echo off
  
  set /p domain="Enter Domain without TLD (E.g 'facebook', 'google'): "
  set /p com_tld="Enter Domain TLD (E.g 'com', 'test'): "
  
  SET HOSTNAME=%domain%
  SET DOT=%com_tld%
  SET COUNTRY=US
  SET STATE=KS
  SET CITY=Olathe
  SET ORGANIZATION=IT
  SET ORGANIZATION_UNIT=IT Department
  SET FULL_DOMAIN=%HOSTNAME%.%DOT%
  SET EMAIL=webmaster@%FULL_DOMAIN%
  
  SET OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf
  
  if not exist .\%HOSTNAME%.%DOT% mkdir .\%FULL_DOMAIN%
  
  (
  echo [req]
  echo default_bits = 2048
  echo prompt = no
  echo default_md = sha256
  echo req_extensions      = v3_req
  echo x509_extensions     = x509_ext
  echo distinguished_name  = dn
  echo:
  echo [dn]
  echo C = %COUNTRY%
  echo ST = %STATE%
  echo L = %CITY%
  echo O = %ORGANIZATION%
  echo OU = %ORGANIZATION_UNIT%
  echo emailAddress = %EMAIL%
  echo CN = %FULL_DOMAIN%
  echo:
  echo [v3_req]
  echo subjectAltName         = @alt_names
  echo subjectKeyIdentifier   = hash
  echo authorityKeyIdentifier = keyid:always, issuer:always
  echo basicConstraints       = critical, CA:TRUE, pathlen:1
  echo keyUsage               = critical, cRLSign, digitalSignature, keyCertSign
  echo nsComment              = "OpenSSL Generated Certificate"
  echo:
  echo [x509_ext]
  echo subjectAltName         = @alt_names
  echo subjectKeyIdentifier   = hash
  echo authorityKeyIdentifier = keyid:always, issuer:always
  echo basicConstraints       = critical, CA:TRUE, pathlen:1
  echo keyUsage               = critical, cRLSign, digitalSignature, keyCertSign
  echo nsComment              = "OpenSSL Generated Certificate"
  echo:
  echo [alt_names]
  echo DNS.1 = *.%FULL_DOMAIN%
  echo DNS.2 = %FULL_DOMAIN%
  )&gt;%FULL_DOMAIN%\%HOSTNAME%.cnf
  
  C:\xampp\apache\bin\openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout %FULL_DOMAIN%\server.key -days 356 -out %FULL_DOMAIN%\server.crt -config %FULL_DOMAIN%\%HOSTNAME%.cnf
  
  echo.
  echo -----
  echo The certificate was provided.
  echo.
  pause
  </code></pre>
  
  <p>This is another I used to generate certificate.</p>
  
  <pre><code>@echo off
  
  set /p domain="Enter Domain without TLD (E.g 'facebook', 'google'): "
  set /p com_tld="Enter Domain TLD (E.g 'com', 'test'): "
  
  SET HOSTNAME=%domain%
  SET DOT=%com_tld%
  SET COUNTRY=US
  SET STATE=KS
  SET CITY=Olathe
  SET ORGANIZATION=IT
  SET ORGANIZATION_UNIT=IT Department
  SET FULL_DOMAIN=%HOSTNAME%.%DOT%
  SET EMAIL=webmaster@%FULL_DOMAIN%
  
  SET OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf
  
  if not exist .\%HOSTNAME%.%DOT% mkdir .\%FULL_DOMAIN%
  
  (
  echo [ req ]
  echo default_bits        = 2048
  echo default_keyfile     = server-key.pem
  echo distinguished_name  = subject
  echo req_extensions      = req_ext
  echo x509_extensions     = x509_ext
  echo string_mask         = utf8only
  echo:
  echo [ subject ]
  echo countryName                 = Country Name ^(2 letter code^)
  echo countryName_default         = %COUNTRY%
  echo stateOrProvinceName         = State or Province Name ^(full name^)
  echo stateOrProvinceName_default = %STATE%
  echo localityName                = Locality Name ^(eg, city^)
  echo localityName_default        = %CITY%
  echo organizationName            = Organization Name ^(eg, company^)
  echo organizationName_default    = %ORGANIZATION%
  echo commonName                  = Common Name ^(e.g. server FQDN or YOUR name^)
  echo commonName_default          = %HOSTNAME%.%DOT%
  echo emailAddress                = Email Address
  echo emailAddress_default        = %EMAIL%
  echo:
  echo [ x509_ext ]
  echo subjectKeyIdentifier   = hash
  echo authorityKeyIdentifier = keyid,issuer
  echo basicConstraints       = CA:FALSE
  echo keyUsage               = digitalSignature, keyEncipherment
  echo subjectAltName         = @alternate_names
  echo nsComment              = "OpenSSL Generated Certificate"
  echo:
  echo [ req_ext ]
  echo subjectKeyIdentifier = hash
  echo basicConstraints     = CA:FALSE
  echo keyUsage             = digitalSignature, keyEncipherment
  echo subjectAltName       = @alternate_names
  echo nsComment            = "OpenSSL Generated Certificate"
  echo:
  echo [ alternate_names ]
  echo:
  echo DNS.1 = *.%HOSTNAME%.%DOT%
  echo DNS.2 = %HOSTNAME%.%DOT%
  )&gt;%FULL_DOMAIN%\%HOSTNAME%.cnf
  
  C:\xampp\apache\bin\openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout %FULL_DOMAIN%\server.key -days 356 -out %FULL_DOMAIN%\server.crt -config %FULL_DOMAIN%\%HOSTNAME%.cnf
  
  echo.
  echo -----
  echo The certificate was provided.
  echo.
  pause
  </code></pre>