Table of Contents
Nginx type server certificate compressed package
Copy the certificate file and private key file
Modify nginx.conf configuration
Check and restart the Nginx service
Home Operation and Maintenance Nginx How to install and deploy Nginx server SSL certificate in Windows environment

How to install and deploy Nginx server SSL certificate in Windows environment

May 15, 2023 am 09:37 AM
windows nginx ssl

Nginx type server certificate compressed package

The contents of the certificate compressed folder are as follows (the domain name of baidu.com is used as an example here):

  • baidu.com_bundle. crt certificate file

  • baidu.com_bundle.pem certificate file (you can ignore this file)

  • baidu.com.key private key file

  • baidu.com.csr CSR file

Copy the certificate file and private key file

Copy the obtained baidu.com_bundle.crt Certificate file and baidu.com.key private key file are copied from the local directory to the conf directory under the Nginx root directory

Modify nginx.conf configuration

Edit the conf/nginx.conf file in the Nginx root directory. The modifications are as follows:

# HTTPS server
#
server {
    #SSL 默认访问端口号为 443
    listen                  443 ssl;
    #请填写绑定证书的域名
    server_name             baidu.com www.baidu.com;

    #请填写证书文件的相对路径或绝对路径
    ssl_certificate         baidu.com_bundle.crt;
    #请填写私钥文件的相对路径或绝对路径
    ssl_certificate_key     baidu.com.key;

    ssl_session_cache       shared:SSL:1m;
    ssl_session_timeout     5m;

    #请按照以下协议配置
    ssl_protocols           TLSv1.2 TLSv1.3;

    #请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
    ssl_ciphers             ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    location / {
        #网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
        #root    html;
        proxy_pass   http://127.0.0.1:8080;
        index   index.html index.htm;
    }
}
Copy after login

HTTP automatic jump to HTTPS security configuration (optional)

server {
    listen 80;
    #请填写绑定证书的域名
    server_name baidu.com www.baidu.com;
    #把http的域名请求转成https
    return 301 https://$host$request_uri;
}
Copy after login

Check and restart the Nginx service

Start the cmd command line in the Nginx root directory

1. Test whether the Nginx configuration is correct

nginx -t
Copy after login

Graceful restart

nginx -s reload
Copy after login

The above is the detailed content of How to install and deploy Nginx server SSL certificate in Windows environment. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1653
14
PHP Tutorial
1251
29
C# Tutorial
1224
24
How to check the name of the docker container How to check the name of the docker container Apr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to start containers by docker How to start containers by docker Apr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

How to create containers for docker How to create containers for docker Apr 15, 2025 pm 12:18 PM

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

See all articles