]>
Commit | Line | Data |
---|---|---|
73ad0f62 | 1 | user nginx nginx; |
2 | worker_processes 5; | |
3 | error_log /var/log/nginx/nginx-perl_error.log; | |
4 | pid /var/run/nginx-perl.pid; | |
5 | ||
6 | events { | |
7 | worker_connections 2048; | |
8 | use epoll; | |
9 | } | |
10 | ||
11 | http { | |
12 | include /etc/nginx/mime.types; | |
13 | default_type application/octet-stream; | |
14 | ||
15 | log_format main '$remote_addr - $remote_user [$time_local] $request ' | |
16 | '"$status" $body_bytes_sent "$http_referer" ' | |
17 | '"$http_user_agent" "$http_x_forwarded_for"'; | |
18 | access_log /var/log/nginx/nginx-perl_access.log main; | |
19 | sendfile on; | |
20 | tcp_nopush on; | |
21 | tcp_nodelay on; | |
22 | server_names_hash_bucket_size 128; | |
3db17524 | 23 | types_hash_max_size 2048; |
24 | types_hash_bucket_size 64; | |
73ad0f62 | 25 | #keepalive_timeout 0; |
26 | keepalive_timeout 65; | |
27 | limit_zone test-limit $binary_remote_addr 10m; | |
28 | #gzip on; | |
29 | ||
98e5ea8d | 30 | # perl_modules perl/lib; |
c2932f9a | 31 | # perl_require /home/services/nginx/cgi-bin/example-hello-01.pm; |
98e5ea8d | 32 | |
33 | perl_set $msie6 ' | |
34 | sub { | |
35 | my $r = shift; | |
36 | my $ua = $r->header_in("User-Agent"); | |
37 | return "" if $ua =~ /Opera/; | |
38 | return "1" if $ua =~ / MSIE [6-9]\.\d+/; | |
39 | return ""; | |
40 | } | |
41 | '; | |
42 | ||
43 | # For more visit | |
44 | # http://wiki.codemongers.com/NginxEmbeddedPerlModule | |
45 | ||
73ad0f62 | 46 | server { |
47 | listen 80; | |
48 | server_name localhost; | |
49 | access_log /var/log/nginx/nginx-perl_access.log main; | |
50 | client_max_body_size 10M; | |
51 | ||
52 | location / { | |
98e5ea8d | 53 | perl example-hello-01::handler; |
73ad0f62 | 54 | limit_conn test-limit 15; |
55 | } | |
56 | ||
57 | ||
c2932f9a | 58 | location ~ ^/cgi-bin/.*\.cgi$ { |
59 | fastcgi_pass unix:/var/run/nginx-perl_cgi.sock; | |
60 | fastcgi_index index.cgi; | |
61 | fastcgi_param SCRIPT_FILENAME /home/services/nginx/$fastcgi_script_name; | |
62 | fastcgi_param QUERY_STRING $query_string; | |
63 | fastcgi_param REQUEST_METHOD $request_method; | |
64 | fastcgi_param CONTENT_TYPE $content_type; | |
65 | fastcgi_param CONTENT_LENGTH $content_length; | |
66 | fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
67 | fastcgi_param SERVER_SOFTWARE nginx; | |
68 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
69 | fastcgi_param REQUEST_URI $request_uri; | |
70 | fastcgi_param DOCUMENT_URI $document_uri; | |
71 | fastcgi_param DOCUMENT_ROOT $document_root; | |
72 | fastcgi_param SERVER_PROTOCOL $server_protocol; | |
73 | fastcgi_param REMOTE_ADDR $remote_addr; | |
74 | fastcgi_param REMOTE_PORT $remote_port; | |
75 | fastcgi_param SERVER_ADDR $server_addr; | |
76 | fastcgi_param SERVER_PORT $server_port; | |
77 | fastcgi_param SERVER_NAME $server_name; | |
78 | fastcgi_read_timeout 5m; | |
79 | } | |
80 | ||
73ad0f62 | 81 | # location /nginx_status { |
82 | # stub_status on; | |
83 | # access_log off; | |
84 | # allow 127.0.0.1; | |
85 | # deny all; | |
86 | # } | |
87 | ||
88 | # error_page 404 /404.html; | |
89 | # error_page 500 502 503 504 /50x.html; | |
90 | # location = /50x.html { | |
91 | # root /home/services/http/error-pages; | |
92 | # } | |
93 | # location = /404.html { | |
94 | # root /home/services/http/error-pages; | |
95 | # } | |
96 | ||
73ad0f62 | 97 | } |
98 | ||
99 | } |