Advertisement
aemirfirdaus

config file

Aug 14th, 2023
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. upstream website2_my {
  2.     server 127.0.0.1:9002;
  3. }
  4.  
  5. server {
  6.     server_name website2.my www.website2.my;
  7.  
  8.     root /var/www/website2proj/public;
  9.     index index.php;
  10.  
  11.     # set max upload size
  12.     client_max_body_size 2G;
  13.     fastcgi_buffers 64 4K;
  14.  
  15.     access_log /var/log/nginx/website2_http_access.log combined;
  16.     error_log /var/log/nginx/website2_http_error.log;
  17.  
  18.     gzip on;
  19.     gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;
  20.     gzip_min_length 1000;
  21.     gzip_vary on;
  22.     gzip_proxied no-cache no-store private expired auth;
  23.     gzip_disable MSIE [1-6];
  24.  
  25.     server_tokens off;
  26.  
  27.     location = /favicon.ico {
  28.         log_not_found off;
  29.         access_log off;
  30.     }
  31.  
  32.     location = /robots.txt {
  33.         allow all;
  34.         log_not_found off;
  35.         access_log off;
  36.     }
  37.  
  38.     location / {
  39.         try_files $uri $uri/ /index.php?$args ;
  40.     }
  41.  
  42.     location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
  43.          try_files $uri /index.php?$query_string;
  44.          access_log off;
  45.          log_not_found off;
  46.          expires 14d;
  47.     }
  48.  
  49.  
  50.     # protected area (XHProf)
  51.     location ^~ /xhprof/xhprof_html/ {
  52.         auth_basic "Restricted";
  53.         auth_basic_user_file /etc/nginx/htpasswd/xhprof;
  54.  
  55.         location ~ \.php(?:$|/) {
  56.           fastcgi_split_path_info ^(.+\.php)(/.+)$;
  57.           include fastcgi_params;
  58.           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  59.           fastcgi_param PATH_INFO $fastcgi_path_info;
  60.           fastcgi_param PHP_FLAG "session.auto_start=off \n mbstring.encoding_translation=off";
  61.           fastcgi_param PHP_VALUE "assert.active=0 \n mbstring.http_input=pass \n mbstring.http_output=pass";
  62.           fastcgi_pass website2_my ;
  63.           fastcgi_read_timeout 60s;
  64.         }
  65.     }
  66.  
  67.     # protected area (phpmyadmin)
  68.     location ^~ /mysqladmin/ {
  69.         auth_basic "Restricted";
  70.         auth_basic_user_file /etc/nginx/htpasswd/phpmyadmin;
  71.  
  72.         location ~ \.php(?:$|/) {
  73.           fastcgi_split_path_info ^(.+\.php)(/.+)$;
  74.           include fastcgi_params;
  75.           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  76.           fastcgi_param PATH_INFO $fastcgi_path_info;
  77.           fastcgi_param PHP_FLAG "session.auto_start=off \n mbstring.encoding_translation=off";
  78.           fastcgi_param PHP_VALUE "assert.active=0 \n mbstring.http_input=pass \n mbstring.http_output=pass";
  79.           fastcgi_pass website2_my;
  80.           fastcgi_read_timeout 60s;
  81.         }
  82.     }
  83.  
  84.     location ^~ /wp-admin/install.php {
  85.         auth_basic "Restricted";
  86.         auth_basic_user_file /etc/nginx/htpasswd/wpadmin;
  87.  
  88.         location ~* \.(htaccess|htpasswd) {
  89.             deny all;
  90.         }
  91.  
  92.         location ~ \.php(?:$|/) {
  93.             fastcgi_split_path_info ^(.+\.php)(/.+)$;
  94.             include fastcgi_params;
  95.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  96.             fastcgi_param PATH_INFO $fastcgi_path_info;
  97.             fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/html/xhprof/external/header.php";
  98.             fastcgi_pass website2_my;
  99.             fastcgi_read_timeout 60s;
  100.         }
  101.     }
  102.  
  103.     location ~* \.(htaccess|htpasswd) {
  104.         deny all;
  105.     }
  106.  
  107.     location ~* \.(?:ini|conf|txt)$ {
  108.         deny all;
  109.     }
  110.  
  111.     location ~ \.php(?:$|/) {
  112.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  113.         include fastcgi_params;
  114.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  115.         fastcgi_param PATH_INFO $fastcgi_path_info;
  116.         fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/html/xhprof/external/header.php";
  117.         fastcgi_pass website2_my;
  118.         fastcgi_read_timeout 60s;
  119.     }
  120.  
  121.     # set long EXPIRES header on static assets
  122.     location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
  123.         expires 30d;
  124.         access_log off;
  125.     }
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. }
  134.  
  135.  
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement