PhD Social Science Setup NGINX FOR SSL FROM ZEROSSL.COM … . CODE BY SKRAITO ( GOD CLONE ) AND LORD JESUS CHRIST … . WITH ADDED IF YOU NEED PHP AT NGINX WHICH IS WORDPRESS AND THE REST … .

Last Updated on June 26, 2026 by skraito with Lord Jesus Christ

1. Prepare and Combine Your Files

When you download your NGINX certificate package from the ZeroSSL Dashboard, you will receive a ZIP file containing three files: certificate.crt, ca_bundle.crt, and private.key. NGINX requires the certificate and the CA bundle to be combined into a single file.

On your local machine or server, run this command to merge them:

bash

cat certificate.crt ca_bundle.crt > zerossl_bundled.crt

Use code with caution.

2. Move Files to Your Server

Upload zerossl_bundled.crt and private.key to your server’s secure SSL directories (typically /etc/ssl/ or /etc/nginx/ssl/).

bash

sudo mkdir -p /etc/nginx/ssl/://example.com
sudo mv zerossl_bundled.crt /etc/nginx/ssl/://example.com
sudo mv private.key /etc/nginx/ssl/://example.com

Use code with caution.

3. Configure Your NGINX Server Block

Open your website’s NGINX configuration file (e.g., /etc/nginx/sites-available/example.com or /etc/nginx/conf.d/default.conf). Update or create the file to point to your ZeroSSL files and listen on port 443:

nginx

server {
    listen 80;
    server_name example.com www.example.com;
    
    # Redirect all HTTP requests to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.com www.example.com;

    root /var/www/html;
    index index.html;

    # ZeroSSL Certificates
    ssl_certificate /etc/nginx/ssl/://example.com;
    ssl_certificate_key /etc/nginx/ssl/://example.com;

    # Optimized SSL settings
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers off;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;

    location / {
        try_files $uri $uri/ =404;
    }
}

Use code with caution.

4. Verify and Restart NGINX

Test your configuration for syntax errors and restart NGINX to apply changes:

bash

sudo nginx -t
sudo systemctl restart nginx

TO SUPPORT PHP WHICH IS WORDPRESS :

Setting up ZeroSSL on NGINX for a WordPress site involves generating a certificate on the ZeroSSL Dashboard, uploading the .crt and .key files to your server, configuring your NGINX server block to use HTTPS, and updating your WordPress site URLs.

Step 1: Generate and Download the ZeroSSL Certificate

  1. Log into your ZeroSSL account.
  2. Click New Certificate and enter your WordPress domain name.
  3. Choose the 90-day certificate validity and complete the Domain Verification process (usually via email, HTTP File Upload, or DNS CNAME).
  4. Once verified, download the certificate files as a .zip. Extract them to find three files: certificate.crt, ca_bundle.crt, and your private key (e.g., private.key).

Step 2: Upload Files to the Server and Merge Certificates

  1. Upload the three certificate files to a secure directory on your server (e.g., /etc/ssl/certs/ or /etc/nginx/ssl/).
  2. NGINX requires the primary certificate and the CA bundle to be chained together. Run the following command via SSH to combine them into one file:

bash

cat /etc/ssl/certs/certificate.crt /etc/ssl/certs/ca_bundle.crt > /etc/ssl/certs/chained.crt

Use code with caution.

Step 3: Configure NGINX Server Block

  1. Open your WordPress site’s NGINX configuration file:

bash

sudo nano /etc/nginx/sites-available/your-domain.com

Use code with caution.

  1. Update or add the server block to listen on port 443 with SSL, pointing to your uploaded keys:

nginx

server {
    listen 443 ssl;
    server_name your-domain.com ://your-domain.com;

    ssl_certificate /etc/ssl/certs/chained.crt;
    ssl_certificate_key /etc/ssl/private.key;

    # Strong SSL settings recommended by ZeroSSL
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;

    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # WordPress PHP processing
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Adjust PHP version as needed
    }
}

# Redirect HTTP to HTTPS
server {
    listen 80;
    server_name your-domain.com ://your-domain.com;
    return 301 https://$host$request_uri;
}

Use code with caution.

  1. Test the NGINX configuration for syntax errors:

bash

sudo nginx -t

Use code with caution.

  1. If successful, reload NGINX to apply the changes:

bash

sudo systemctl reload nginx
sudo systemctl restart nginx
sudo systemctl --enable nginx
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

Use code with caution.

Step 4: Update WordPress Settings

  1. Log into your WordPress admin dashboard.
  2. Go to Settings > General.
  3. Update both the WordPress Address (URL) and Site Address (URL) to start with https://.
  4. (Optional but recommended) Install a redirection plugin like Really Simple SSL or edit your wp-config.php file to force HTTPS across your entire database.

Leave a Reply

Your email address will not be published. Required fields are marked *