Advertisement
pvanheus

Untitled

Mar 12th, 2015
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.97 KB | None | 0 0
  1. upstream php {
  2.    server unix:/var/run/php5-fpm.sock;
  3. }
  4.  
  5. server {
  6.         listen 443;
  7.         ssl on;
  8.         server_name .wp.sanbi.ac.za *.wp.sanbi.ac.za blog.sanbi.ac.za *.blog.sanbi.ac.za;
  9.        
  10.         ssl_certificate /etc/ssl/certs/sanbi.pem;
  11.         ssl_certificate_key /etc/ssl/private/sanbi.key;
  12.  
  13.         root /usr/lib/wordpress;
  14.         index index.php index.html index.htm;
  15.  
  16.         location /sanbi-login.html {
  17.             auth_pam  "SANBI authentication";
  18.             auth_pam_service_name "nginx";
  19.         }
  20.         # Process only the requests to wp-login and wp-admin
  21.         location ~ /wp-(admin|login|includes|content) {
  22.  
  23.           try_files $uri $uri/ \1/index.php?args;
  24.  
  25.           location ~ \.php$ {
  26.              try_files $uri =404;
  27.              include fastcgi_params;
  28.              fastcgi_param REMOTE_USER $remote_user;
  29.              fastcgi_index index.php;
  30.              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  31.              fastcgi_pass  php;
  32.              fastcgi_intercept_errors on;
  33.           }
  34.         }
  35.         # Redirect everything else to port 80
  36.         location / {
  37.           return 301 http://$host$request_uri;
  38.         }
  39.         access_log /var/log/nginx/ssl-access.log;
  40.         error_log /var/log/nginx/ssl-error.log;
  41. }
  42.  
  43. server {
  44.     #listen   80; ## listen for ipv4; this line is default and implied
  45.     #listen   [::]:80 default ipv6only=on; ## listen for ipv6
  46.  
  47.         server_name wp.sanbi.ac.za *.wp.sanbi.ac.za blog.sanbi.ac.za *.blog.sanbi.ac.za;
  48.     root /usr/lib/wordpress;
  49.  
  50.         index index.php;
  51.  
  52.         location ~ /wp-(?:admin|login) {
  53.                 return 301 https://$host$request_uri;
  54.         }
  55.  
  56.         location = /favicon.ico {
  57.                 log_not_found off;
  58.                 access_log off;
  59.         }
  60.  
  61.         location = /robots.txt {
  62.                 allow all;
  63.                 log_not_found off;
  64.                 access_log off;
  65.         }
  66.  
  67.         location / {
  68.                 # This is cool because no php is touched for static content.
  69.                 # include the "?$args" part so non-default permalinks doesn't break when using query string
  70.                 try_files $uri $uri/ /index.php?$args;
  71.         }
  72.  
  73.         location ~ \.php$ {
  74.                 #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  75.                 location ~ /wp-(admin|login) {
  76.                   return 301 https://$host$request_uri;
  77.                 }
  78.                 try_files $uri =404;
  79.                 include fastcgi_params;
  80.                 fastcgi_intercept_errors on;
  81.                 fastcgi_pass php;
  82.         }
  83.  
  84.     location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
  85.         access_log off; log_not_found off; expires max;
  86.     }
  87.  
  88.     location ~ /\. { deny  all; access_log off; log_not_found off; }
  89.  
  90.         access_log /var/log/nginx/access.log;
  91.         error_log /var/log/nginx/error.log;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement