server {
    listen   80;
    server_name zzcandor.com;
    server_name www.zzcandor.com;
    #return 301 https://$server_name1$request_uri;
    rewrite ^(.*)$  https://$hostThe $1 permanent;  
}

server
{
listen 443 ssl;   The SSL protocol access port number is 443. If SSL is not added, Nginx may fail to start.
server_name zzcandor.com;
server_name www.zzcandor.com;

# rewrite ^(.*)$ https://$host$1 permanent; Redirect all HTTP requests to HTTPS via rewrite.

root /projects/blog-react/build;

ssi on;
ssi_silent_errors on;

error_page 404  /404.html;

ssl_certificate cert/zzcandor.com.pem;   # Replace domain name.pem with the file name of your certificate.
ssl_certificate_key cert/zzcandor.com.key;   # Replace domain name.key with the key file name of your certificate.ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:! NULL:! aNULL:! MD5:! ADH:! RC4;# Use this encryption suite.Ssl_protocols TLSv1 TLSv1.1 TLSv1.2;Configure using this protocol.ssl_prefer_server_ciphers on; Location /blogapi/ {proxy_pass http://127.0.0.1:6060/; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH; proxy_set_header Host$host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header REMOTE-HOST $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

      gzip on;
      gzip_http_version 1.1;
      gzip_comp_level 3;
      gzip_types text/plain application/json application/x-javascript application/css application/xml application/xml+rss text/javascript application/x-httpd-php image/jpeg image/gif image/png image/x-ms-bmp;

 location /{
      try_files $uri /index.html;
      add_header Access-Control-Allow-Origin *;
      add_header Access-Control-Allow-Headers X-Requested-With;
      add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header REMOTE-HOST $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}Copy the code