test

Plain text code posted by john
created at 23 Sep 07:27, updated at 24 Sep 06:19

Edit | Back
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# install openssh-server
$ sudo apt-get install openssh-server

#install updates and tools
$ sudo apt-get update?$ sudo apt-get upgrade?$ sudo apt-get install build-essential

# install php
$ sudo apt-get install php5-cli php5-cgi

# get Nginx
$ wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz

# install dependancies for nginx
$ sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev

# untar
$ tar -zxvf nginx-0.7.62.tar.gz 

# configure
$ ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module

# make and make install
$ make
$ sudo make install

# run
$ sudo /usr/local/sbin/nginx 

# PHP and FCGI

# install subversion
$ sudo apt-get install subversion

# check out spawn-fcgi
$ svn co svn://svn.lighttpd.net/spawn-fcgi/trunk spawn-fcgi

# install automake
$ sudo apt-get install automake

# configure and install
$ ./autogen.sh
$ sudo ./configure
$ make
$ sudo make install

# Nginx virtual hosts
$ sudo nano /usr/local/nginx/conf/nginx.con

# paste in nginx.conf, at the bottom, but before the find curly brace "}"
server {
       listen 80;
       server_name www.yourdomain.com;
       if (!-e $request_filename) {
          rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last;
          rewrite ^([_0-9a-zA-Z-]+)?(/.*\.php)$ $2 last;
          rewrite ^ /index.php last;
          }
        location / {
        root /usr/local/nginx/html;
        index index.html index.php index.htm;
        }       
        location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
        fastcgi_param REQUEST_URI $request_uri;
        fastcgi_param DOCUMENT_URI $document_uri;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE nginx;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
        }
}
# start new PHP FastCGI instance
$ sudo spawn-fcgi -a 127.0.0.1 -p9000 -u www-data -f /usr/bin/php5-cgi
2.5 KB in 4 ms with coderay