SHARE
TWEET

nginx cfg

a guest Jun 19th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. server {
  3.     server_name dev.bingothon.com;
  4.     root /var/www/dev.bingothon.com; ## <-- Your only path reference.
  5.  
  6.     listen 80;
  7.     listen [::]:80;
  8.     listen 443 default ssl;
  9.  
  10.  
  11.     ssl_certificate      /etc/nginx/ssl/dev.bingothon.com.crt;
  12.     ssl_certificate_key  /etc/nginx/ssl/dev.bingothon.com.key;
  13.  
  14.     # Redirect HTTP to HTTPS
  15.     if ($scheme = http) {
  16.         return 301 https://$server_name$request_uri;
  17.     }
  18.  
  19.     location = /favicon.ico {
  20.         log_not_found off;
  21.         access_log off;
  22.     }
  23.  
  24.     location = /robots.txt {
  25.         allow all;
  26.         log_not_found off;
  27.         access_log off;
  28.     }
  29.  
  30.     # Very rarely should these ever be accessed outside of your lan
  31.     location ~* \.(txt|log)$ {
  32.         allow 192.168.0.0/16;
  33.         deny all;
  34.     }
  35.  
  36.     location ~ \..*/.*\.php$ {
  37.         return 403;
  38.     }
  39.  
  40.     location ~ ^/sites/.*/private/ {
  41.         return 403;
  42.     }
  43.  
  44.     # Block access to "hidden" files and directories whose names begin with a
  45.     # period. This includes directories used by version control systems such
  46.     # as Subversion or Git to store control files.
  47.     location ~ (^|/)\. {
  48.         return 403;
  49.     }
  50.  
  51.     location / {
  52.         # try_files $uri @rewrite; # For Drupal <= 6
  53.         try_files $uri /index.php?$query_string; # For Drupal >= 7
  54.     }
  55.  
  56.     location @rewrite {
  57.         rewrite ^/(.*)$ /index.php?q=$1;
  58.     }
  59.  
  60.     # In Drupal 8, we must also match new paths where the '.php' appears in the middle,
  61.     # such as update.php/selection. The rule we use is strict, and only allows this pattern
  62.     # with the update.php front controller.  This allows legacy path aliases in the form of
  63.     # blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have
  64.     # any paths like that, then you might prefer to use a laxer rule, such as:
  65.     #   location ~ \.php(/|$) {
  66.     # The laxer rule will continue to work if Drupal uses this new URL pattern with front
  67.     # controllers other than update.php in a future release.
  68.     location ~ '\.php$|^/update.php' {
  69.         fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
  70.         #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  71.         include fastcgi_params;
  72.         include snippets/fastcgi-php.conf;
  73.         fastcgi_param SCRIPT_FILENAME $request_filename;
  74.         fastcgi_intercept_errors on;
  75.         fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  76.     }
  77.  
  78.     # Fighting with Styles? This little gem is amazing.
  79.     # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6
  80.     location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7
  81.         try_files $uri @rewrite;
  82.     }
  83.  
  84.     location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  85.         expires max;
  86.         log_not_found off;
  87.     }
  88. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top