It is almost a standard feature for websites nowadays to support Https, and Nginx can support the Https function very well. The following is a configuration that supports both Http and Https functions. It should be noted that since Https is chosen to ensure communication security, there is no need to use Http for communication. The Http method is also supported in the URL, mainly for users who do not know whether the website supports Https or use Http to access it. At this time, the Nginx backend needs to automatically convert the Http request into Https, so that it can support Http and ensure communication security. Without further ado, here is a configuration of Nginx supporting Http and Https. This is the configuration of my WordPress website supporting Https. You can refer to it. server { # Enable Https listen 443 ssl; # Configure the certificate. I won’t go into details about how to apply for a free certificate. Search for Tencent Cloud or Alibaba Cloud free certificate application at night ssl_certificate /etc/nginx/conf.d/cert/4351595_www.xxx.pem; ssl_certificate_key /etc/nginx/conf.d/cert/4351595_www.xxx.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; server_name xxx; index index.html index.htm index.php; root /data/wwwroot/wordpress; error_log /var/log/nginx/wordpress-error.log crit; access_log /var/log/nginx/wordpress-access.log; # This is used to include other configurations include extra/*.conf; include conf.d/rewrite/wordpress.conf; } # Convert Http request to Https request server { listen 80; server_name xxx; rewrite ^/(.*) https://$server_name$request_uri? permanent; } This is the end of this article about the detailed configuration of Nginx supporting both Http and Https. For more relevant configuration content of Nginx supporting both Http and Https, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to gracefully and safely shut down the MySQL process
>>: How to add Vite support to old Vue projects
At the beginning of this article, I would like to ...
When configuring nginx reverse proxy, the slashes...
1. Command Introduction The contab (cron table) c...
The default_server directive of nginx can define ...
Starting and shutting down Tomcat under Linux In ...
My mysql version is MYSQL V5.7.9, please use the ...
Table of contents 1. Install Docker 2. Write code...
Nowadays we often talk about Web2.0, so what is W...
1. Add PRIMARY KEY (primary key index) mysql>A...
Table of contents Routing Manager background gett...
Introduction to influxDB influxDB is a distribute...
Table of contents 1. ES syntax getter and setter ...
Use the --all-database parameter when performing ...
Regarding the high availability solutions for Ora...
This article shares the specific code of JS to ac...