Nginx HTTP HTTPS Configuration

For the security of data transmission and to prevent web pages from being maliciously tampered with, most websites are now configured with https.

How to ensure that users access through https?

If nginx is useful, we can configure forced redirection.

Add in the nginx configuration:

server {

listen 80;
listen 443 ssl;
server_name www.imcati.com;
root /usr/share/nginx/html;
if ($server_port = 80) {return 301 https://$server_name$request_uri;}
# return 301 https:// $server_name$request_uri; can be written as rewrite ^/(.*)$
https://$server_name$1;
 .... .. 

location / {
index index.html;
}
}

Access test:

< p>share picture

We can When you see the content of the http request, the https finally requested, so as to verify that the configuration is successful.

server {

listen 80;
listen 443 ssl;
server_name www.imcati.com;
root /usr/share/nginx/html;
if ($server_port = 80) {return 301 https://$server_name$request_uri;}
# return 301 https:// $server_name$request_uri; can be written as rewrite ^/(.*)$
https://$server_name$1;
 .... .. 

location / {
index index.html;
}
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4601 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.