aboutsummaryrefslogtreecommitdiff
path: root/nginx.sample
blob: b1a33e63793eb29f580a2323389e350b0f2e19be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
server {
   listen      80;
   server_name example.co.uk;

   index       index.php index.html index.htm;
   autoindex   on;

   root        /var/www;

   rewrite   \/blog\/feed\/?$         /blog/rss.php;
   rewrite   \/blog\/posts\/?$        /blog/archives.php;
   rewrite   \/blog\/post\/(.*)$      /blog/viewpost.php?post=$1;

   location /dopost.php {
      auth_basic           "Login to post";
      auth_basic_user_file /var/www/.htpasswd;
      include              /etc/nginx/fastcgi_params;
      fastcgi_pass         unix:/var/run/php-fastcgi/php-fastcgi.socket;
      fastcgi_index        index.php;
      fastcgi_param        SCRIPT_FILENAME /var/www/dopost.php;
   }

   location ~ \.php$ {
       include         /etc/nginx/fastcgi_params;
       fastcgi_pass    unix:/var/run/php-fastcgi/php-fastcgi.socket;
       fastcgi_index   index.php;
       fastcgi_param   SCRIPT_FILENAME /var/www/$fastcgi_script_name;
   }
}