openwrt 下lighttpd Typecho URL重定向规则



 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
url.rewrite = (
	"^/(.*)\.htlighttpdml$" => "/index.php/$1\.html", 
	"^/archives/(.*)" => "/index.php/archives/$1", 
	"^/category/(.*)" => "/index.php/category/$1", 
	"^/([0-9]+)/([0-9]+)/$" => "/index.php/$1/$2/", 
	"^/tag/(.*)/$" => "/index.php/tag/$1", 
	"^/search/(.*)/$" => "/index.php/search/$1", 
	"^/(.*)page/(.*)" => "/index.php/$1page/$2", 
	"^/(feed.*)" => "/index.php/$1", 
	"^/action/(.*)" => "/index.php/action/$1",
        "^/(.*)/comment" => "/index.php/$1/comment",
        "^/sitemap.xml" => "/sitemap.xml",
        "^/favicon.ico" => "/favicon.ico"
 
)

 

 

1
2
3
4
5
server.modules = (
   "mod_rewrite",
   "mod_fastcgi",
   "mod_evasive"
)
lighttpd.conf 全文
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# lighttpd configuration file
# 
## modules to load
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
   "mod_rewrite",
   "mod_fastcgi",
   "mod_evasive"
)
 
#server.modules = ( 
#	"mod_rewrite", 
#	"mod_redirect", 
#	"mod_alias", 
#	"mod_auth", 
#	"mod_status", 
#	"mod_setenv",
#	"mod_fastcgi",
#	"mod_proxy",
#	"mod_simple_vhost",
#	"mod_cgi",
#	"mod_ssi",
#	"mod_usertrack",
#	"mod_expire",
#	"mod_webdav"
#)
 
 
 
 
# force use of the "write" backend (closes: #2401)
server.network-backend = "write"
 
## a static document-root, for virtual-hosting take look at the 
## server.virtual-* options
server.document-root = "/mnt/sda1/RG100A/www/"
 
## where to send error-messages to
#server.errorlog = "/var/log/lighttpd/error.log"
 
## files to check for if .../ is requested
index-file.names = ( "index.php","index.html", "default.html", "index.htm", "default.htm" )
 
## mimetype mapping
mimetype.assign = (  
	".pdf"   => "application/pdf",
	".class" => "application/octet-stream",
	".pac"   => "application/x-ns-proxy-autoconfig",
	".swf"   => "application/x-shockwave-flash",
	".wav"   => "audio/x-wav",
	".gif"   => "image/gif",
	".jpg"   => "image/jpeg",
	".jpeg"  => "image/jpeg",
	".png"   => "image/png",
	".css"   => "text/css",
	".html"  => "text/html",
	".htm"   => "text/html",
	".js"    => "text/javascript",
	".txt"   => "text/plain",
	".dtd"   => "text/xml",
	".xml"   => "text/xml"
 )
 
## Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetypes.use-xattr = "enable"
 
## send a different Server: header
## be nice and keep it at lighttpd
#server.tag = "lighttpd"
 
$HTTP["url"] =~ "\.pdf$" {
	server.range-requests = "disable"
}
 
##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
 
######### Options that are good to be but not neccesary to be changed #######
 
## bind to port (default: 80)
server.port = 88
 
## bind to localhost (default: all interfaces)
#server.bind = "localhost"
 
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
 
## to help the rc.scripts
server.pid-file = "/var/run/lighttpd.pid"
 
 
###### virtual hosts
##
##   If you want name-based virtual hosting add the next three settings and load
##   mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
#simple-vhost.default-host = "grisu.home.kneschke.de"
#simple-vhost.document-root = "/pages/"
 
 
## 
## Format: <errorfile-prefix><status>.html
## -&gt; ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/www/error-"
 
## virtual directory listings
#server.dir-listing = "enable"
 
## send unhandled HTTP-header headers to error-log
#debug.dump-unknown-headers = "enable"
 
### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot = "/"
 
## change uid to <uid> (default: don't care)
#server.username = "nobody"
#
server.upload-dirs = ( "/tmp" )
 
## change uid to <uid> (default: don't care)
#server.groupname = "nobody"
 
#### compress module
#compress.cache-dir          = "/dev/null/"
#compress.filetype           = ("text/plain", "text/html")
 
#### proxy module
## read proxy.txt for more info
#proxy.server = (
#	".php" =&gt; (
#		"localhost" =&gt; (
#			"host" =&gt; "192.168.0.101",
#			"port" =&gt; 80
#		)
#	)
#)
 
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = (
".php" =&gt; (
"localhost" =&gt; (
"socket" =&gt; "/tmp/php-fastcgi.socket",
"bin-path" =&gt; "/usr/bin/php-cgi",
"max-procs" =&gt; 2,
"max-load-per-proc" =&gt; 4,
"idle-timeout" =&gt; 20,
"bin-environment" =&gt;(
"PHP_FCGI_CHILDREN" =&gt; "1",
"PHP_FCGI_MAX_REQUESTS" =&gt; "500"
),
"bin-copy-environment" =&gt; ("PATH","SHELL","USER")
)
)
)
 
 
 
 
#fastcgi.server = (
#        ".php" =&gt; (
#                "localhost" =&gt; (
#                        "socket" =&gt; "/tmp/php-fastcgi.socket",
#                        "bin-path" =&gt; "/usr/bin/php-fcgi"
#                )
#        )
#)
#### CGI module
#cgi.assign = ( ".php" =&gt; "/usr/bin/php-cgi" )
#cgi.assign = ( ".pl"  =&gt; "/usr/bin/perl", ".cgi" =&gt; "/usr/bin/perl" )
 
#### SSL engine
#ssl.engine = "enable"
#ssl.pemfile = "server.pem"
 
#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"
 
#### auth module
## read authentification.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.require = (
#	"/server-status" =&gt; ( 
#		"method"  =&gt; "digest",
#		"realm"   =&gt; "download archiv",
#		"require" =&gt; "group=www|user=jan|host=192.168.2.10"
#	),
#	"/server-info" =&gt; ( 
#		"method"  =&gt; "digest",
#		"realm"   =&gt; "download archiv",
#		"require" =&gt; "group=www|user=jan|host=192.168.2.10"
#	)
#)
 
#### url handling modules (rewrite, redirect, access)
url.rewrite = (
	"^/(.*)\.html$" =&gt; "/index.php/$1\.html", 
	"^/archives/(.*)" =&gt; "/index.php/archives/$1", 
	"^/category/(.*)" =&gt; "/index.php/category/$1", 
	"^/([0-9]+)/([0-9]+)/$" =&gt; "/index.php/$1/$2/", 
	"^/tag/(.*)/$" =&gt; "/index.php/tag/$1", 
	"^/search/(.*)/$" =&gt; "/index.php/search/$1", 
	"^/(.*)page/(.*)" =&gt; "/index.php/$1page/$2", 
	"^/(feed.*)" =&gt; "/index.php/$1", 
	"^/action/(.*)" =&gt; "/index.php/action/$1",
        "^/(.*)/comment" =&gt; "/index.php/$1/comment",
        "^/sitemap.xml" =&gt; "/sitemap.xml",
        "^/favicon.ico" =&gt; "/favicon.ico"
 
)  
#url.redirect = ( "^/wishlist/(.+)" =&gt; "http://192.168.1.1:88/$1" )
 
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
#	url.redirect = ( "^/(.*)" =&gt; "http://%1/$1" )
#}
 
#### expire module
#expire.url = ( "/buggy/" =&gt; "access 2 hours", "/asdhas/" =&gt; "access plus 1 seconds 2 minutes")
 
#### ssi
#ssi.extension = ( ".shtml" )
 
#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" =&gt; "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" =&gt; "42" )
 
#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"
 
## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")
 
#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"
 
#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
 
#### webdav
#$HTTP["url"] =~ "^/webdav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "enable"
# webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"
#}
url.access-deny = ( "~", ".inc",".sqlite" )
evasive.max-conns-per-ip = 8
  • No Comments Yet

添加新评论 »

captcha