RSS
热门关键字:  php  lighttpd  找回密码  密码找回  client
当前位置 :| 主页>技术资料>Httpd server>

nginx 安装

来源: 作者:本站编辑 时间:2008-08-09 Tag:Nginx     点击:

http://sysoev.ru/en/ 上下载一个最近版本

配置参考文档,很不错

http://wiki.codemongers.com/NginxChs 里面有好多的教程资料

解压缩

sudo ./configure --user=www --group=www --prefix=/data/app/nginx/ --with-http_stub_status_module --with-openssl=/usr/local/openssl

sudo make

sudo make install

以前没有安装 pcre 可能需要安装 一下

配置conf文件

nginx.conf

1 user www www;
2 #user nobody;
3 worker_processes 10;
4
5 error_log logs/error.log;
6 #error_log logs/error.log notice;
7 #error_log logs/error.log info;
8
9 pid        logs/nginx.pid;
10
11
12 events {
13     use epoll;
14     worker_connections 51200;
15 }
16
17
18 http {
19     include       conf/mime.types;
20     default_type application/octet-stream;
21
22     log_format main '$remote_addr - $remote_user [$time_local] $request '
23                       '"$status" $body_bytes_sent "$http_referer" '
24                       '"$http_user_agent" "$http_x_forwarded_for"';
25
26     access_log logs/access.log main;
27
28     sendfile        on;
29     #tcp_nopush     on;
30
31     #keepalive_timeout 0;
32     keepalive_timeout 65;
33
34     #gzip on;
35
36     server {
37         listen       80;
38         server_name localhost;
39
40         charset utf-8;
41
42         #access_log logs/host.access.log main;
43 44         location / {
45             root   html;
46             index index.html index.htm;
47         }
48
49         #error_page 404              /404.html;
50
51         # redirect server error pages to the static page /50x.html
52         #
53         error_page   500 502 503 504 /50x.html;
54         location = /50x.html {
55             root   html;
56         }
57
58         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
59         #
60         #location ~ \.php$ {
61         #    proxy_pass   http://127.0.0.1;
62         #}
63
64         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
65         #
66         #location ~ \.php$ {
67         #    fastcgi_pass   127.0.0.1:9000;
68         #    fastcgi_index index.php;
69         #    fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
70         #    include        conf/fastcgi_params;
71         #}
72
73         # deny access to .htaccess files, if Apache's document root
74         # concurs with nginx's one
75         #
76         #location ~ /\.ht {
77         #    deny all;
78         #}
79     }
80
81     # The following includes are specified for virtual hosts   //以下是加载虚拟主机配置.
82     #[url]dev3.yahoo.cn[/url]
83     include          conf/vhosts/dev3.conf;
84     # another virtual host using mix of IP-, name-, and port-based configuration

建立 dev3.conf

server
       {
                  listen       80;
                  server_name dev3.cn;
                  index index.html index.htm index.php;
                  root /data/website;
                  location ~ .*\.php?$
                                         {
                                                            include conf/enable_php5.conf;
                                         }
           }

建立enable_php5.conf

fastcgi_pass 127.0.0.1:8085;
fastcgi_index index.php;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE    nginx;
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     $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME        $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 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;
fastcgi_param REDIRECT_STATUS    200;

启动

sudo /data/app/phpcgi/bin/spawn-fcgi -a 127.0.0.1 -p 8085 -C 250 -u www -f /data/app/phpcgi/bin/php-cgi

spawn-fcgi 的由来是编译lighttpd以后就可以找到

sudo /data/app/nginx/sbin/nginx -c /data/app/nginx/conf/nginx.conf


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册