How to Update the SSL Domain Certificate After Self-Hosting a JihuLab Code Platform
Background
After deploying a self-hosted JihuLab code platform, the domain's SSL certificate expired, making the management interface inaccessible. Local code could no longer be synchronized with the remote repository.
Objective: Update the domain's SSL certificate to restore access to the platform and enable code synchronization.
Implementation Steps
1. Locate the Certificate Configuration in JihuLab
Run the following command to check the actual certificate paths configured in JihuLab:
grep -nEi "external_url|ssl_certificate|ssl_certificate_key|letsencrypt" /etc/gitlab/gitlab.rb
The output will look similar to the following:
external_url 'https://explore.com'
nginx['ssl_certificate'] = "/etc/gitlab/ssl/explore.com.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/explore.com.key"
Based on the configuration above, the certificate files are located in the following directory:
/etc/gitlab/ssl/
2. Download the New Certificate
Download the newly issued SSL certificate. In my case, I obtained the certificate from Alibaba Cloud and downloaded the NGINX version.
Note: Select the certificate package that matches your server environment. For example, download the NGINX version for an NGINX environment or the Apache version for an Apache environment.
3. Create a New Directory and Upload the Certificate Files
Under the certificate directory identified in Step 1, create a new directory and upload the certificate files.
Make sure the certificate files have the appropriate access permissions. In my case, I set the permissions to 755.
4. Modify the JihuLab Configuration File
Open the JihuLab configuration file:
vim /etc/gitlab/gitlab.rb
Locate the certificate configuration entries and update the paths to point to the newly created directory:
nginx['ssl_certificate'] = "/etc/gitlab/ssl/20260930/explore.com.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/20260930/explore.com.key"
Common Vim commands:
i: Enter insert mode to edit the file.
esc: Exit insert mode and return to command mode.
:q!: Quit without saving changes.
:wq: Save changes and quit.
5. Apply the Updated Configuration
Run the following command to reconfigure JihuLab and apply the changes made to the configuration file:
gitlab-ctl reconfigure
6. Restart the NGINX Service
Restart the NGINX service to ensure that it loads the updated SSL certificate:
gitlab-ctl restart nginx
7. Verify the NGINX Service Status
Check whether the NGINX service has restarted successfully:
gitlab-ctl status nginx
If the service is running normally, the SSL certificate update should be complete.
Conclusion
By following these steps, you can replace an expired SSL certificate on a self-hosted JihuLab code platform without overwriting the original certificate files.
The key steps are to locate the existing certificate configuration, upload the new certificate, update the certificate paths in the configuration file, reconfigure JihuLab, and restart NGINX.
After completing the update, verify that the management interface is accessible over HTTPS and that local code can be synchronized with the remote repository again.
Comments
Post a Comment