skip to Main Content

I have one website virtual hosting under xampp apache and using certbot to obtain ssl cert

certbot certonly --webroot --w C:\xampp\htdocs\mysite\wordpress --d www.mysite.com

After successful obtain
It created 4 pem files in C:Certboxarchivemysite and 4 .smylink(.pem) files in C:Certboxlivemysite which symlink to those 4 files on archive folder

Heres the problem:
Everytime I reboot the pc, those 4 .smylink(.pem) files seems lost its target to those 4 pem files in C:Certboxarchivemysite and seems to became broken and preventing xampp apache from starting

What I’ve tried:

  1. Cmd run cd C:Certbotlivemysite then del cert.pem.symlink and recreate mklink /H cert.pem.symlink C:Certbotarchivemysitecert.pem

2

Answers


  1. Chosen as BEST ANSWER

    It turn out is the permission issues,those symlink has reset the permissions after system reboot which is very odd , this explain why the "shortcut" tab in properties was missing which I missunderstand the symlink was losing the target.

    I have to regrant permissions to those symlink files by doing icacls <path> /grant Everyone:(R) via cmd


  2. It seems like the issue you’re facing is related to symbolic links being broken after a system reboot. Windows might reset the symbolic links or the paths might change during startup.

    One solution is to create a batch script that recreates the symbolic links each time your computer starts up. Here’s an example of how you can create a simple batch script:

    1. Open Notepad or any text editor.

    2. Copy and paste the following script into the editor:

      @echo off
      
      set certbot_path=C:Certbot
      set site_name=mysite
      
      mklink /H "%certbot_path%live%site_name%cert.pem.symlink" "%certbot_path%archive%site_name%cert.pem"
      mklink /H "%certbot_path%live%site_name%privkey.pem.symlink" "%certbot_path%archive%site_name%privkey.pem"
      mklink /H "%certbot_path%live%site_name%fullchain.pem.symlink" "%certbot_path%archive%site_name%fullchain.pem"
      mklink /H "%certbot_path%live%site_name%chain.pem.symlink" "%certbot_path%archive%site_name%chain.pem"
      
      exit
      
    3. Save the file with a .bat extension, for example, recreate_links.bat. Save it to a location of your choice.

    To make this script run on startup, you can create a shortcut to it and place the shortcut in the Startup folder.

    1. Press Win + R to open the Run dialog.

    2. Type shell:startup and press Enter. This opens the Startup folder.

    3. Copy the shortcut of your recreate_links.bat script into this folder.

    Now, every time your computer starts up, it will execute the batch script and recreate the symbolic links for you.

    PS: Adjust the paths in the script if your actual paths are different.

    PPS: This has never happened to me as I primarily use a Linux-based System.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search