Advertisement
Guest User

Edited with extensionless

a guest
Jan 13th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.28 KB | None | 0 0
  1. # Redirect www https to non-www https
  2. server {
  3.     listen IP:443 ssl http2;
  4.     server_name www.domain.com;
  5.  
  6.     ssl         on;
  7.     ssl_certificate      /home/admin/conf/web/ssl.domain.com.pem;
  8.     ssl_certificate_key  /home/admin/conf/web/ssl.domain.com.key;
  9.  
  10.     return 301 https://domain.com$request_uri;
  11. }
  12. server {
  13.     listen      IP:443 ssl http2;
  14.     server_name domain.com www.domain.com;
  15.     root        /home/admin/web/domain.com/public_html;
  16.     index       index.php index.html index.htm;
  17.     access_log  /var/log/nginx/domains/domain.com.log combined;
  18.     access_log  /var/log/nginx/domains/domain.com.bytes bytes;
  19.     error_log   /var/log/nginx/domains/domain.com.error.log error;
  20.  
  21.     ssl         on;
  22.     ssl_certificate      /home/admin/conf/web/ssl.domain.com.pem;
  23.     ssl_certificate_key  /home/admin/conf/web/ssl.domain.com.key;
  24.  
  25.     location / {
  26.  
  27.         try_files $uri $uri.html $uri/ @extensionless-php;
  28.         index index.html index.htm index.php;
  29.  
  30.         location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
  31.             expires     max;
  32.         }
  33.  
  34.         location ~ \.php$ {
  35.         try_files $uri =404;
  36.         }
  37.  
  38.         location @extensionless-php {
  39.         rewrite ^(.*)$ $1.php last;
  40.         }
  41.  
  42.         location ~ [^/]\.php(/|$) {
  43.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  44.             if (!-f $document_root$fastcgi_script_name) {
  45.                 return  404;
  46.             }
  47.  
  48.             fastcgi_pass    127.0.0.1:9002;
  49.             fastcgi_index   index.php;
  50.             include         /etc/nginx/fastcgi_params;
  51.         }
  52.     }
  53.  
  54.     error_page  403 /error/404.html;
  55.     error_page  404 /error/404.html;
  56.     error_page  500 502 503 504 /error/50x.html;
  57.  
  58.     location /error/ {
  59.         alias   /home/admin/web/domain.com/document_errors/;
  60.     }
  61.  
  62.     location ~* "/\.(htaccess|htpasswd)$" {
  63.         deny    all;
  64.         return  404;
  65.     }
  66.  
  67.     location /vstats/ {
  68.         alias   /home/admin/web/domain.com/stats/;
  69.         include /home/admin/conf/web/domain.com.auth*;
  70.     }
  71.  
  72.     include     /etc/nginx/conf.d/phpmyadmin.inc*;
  73.     include     /etc/nginx/conf.d/phppgadmin.inc*;
  74.     include     /etc/nginx/conf.d/webmail.inc*;
  75.  
  76.     include     /home/admin/conf/web/snginx.domain.com.conf*;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement