Nginx conf + ssl

server {
   listen  443 ssl http2;
   server_name  www.example1.com example1.com;
   port_in_redirect off;
   rewrite /wp-admin$ $scheme://$host$uri/index.php?q=$1 permanent;

   ssl_certificate /etc/nginx/ssl/example1/example1_chain.crt;
   ssl_certificate_key  /etc/nginx/ssl/example1/example1.key;
   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
   ssl_prefer_server_ciphers   on;

   ssl_session_cache   shared:SSL:20m;
   ssl_session_timeout 60m;
   client_max_body_size 50M;
   #add_header Strict-Transport-Security "max-age=31536000";
   #add_header X-Content-Type-Options nosniff;

   location / {
     proxy_pass http://127.0.0.1:80;
     proxy_set_header Host $http_host;
     proxy_set_header X-Forwarded-Host $http_host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto https;
     proxy_set_header HTTPS "on";

     access_log /var/log/nginx/example1-access.log vhosts;
     error_log  /var/log/nginx/example1-error.log notice;
     }
}


server {
  listen 8080;
  server_name example1.com www.example1.com;
  root /var/www/example1.com;
  port_in_redirect off;
  index index.php index.html index.htm;

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

  location ~ \.php$ {
       try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       include fastcgi_params;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_param HTTPS on;
       fastcgi_pass unix:/var/run/php/php7.2-example1-fpm.sock;
       }

  location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm|pdf)$ {
      expires 3w;
      access_log off;
      add_header Pragma public;
      add_header Cache-Control "public";
   }

 

Was this article helpful?

Related Articles

Leave A Comment?