aboutsummaryrefslogtreecommitdiff
path: root/nginx.sample
blob: ad5fa4ff70636a82f6a30a3d33b71352e8254930 (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
server {
   listen      80;
   server_name example.co.uk;

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

   root        /var/www;

   rewrite \/post\/(.*)$ /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;
   }
}