Seems than there is an error running grav with caddy server

Hello guys, not sure but grav is generating some issues when I try run it with my caddy server, the error is

2016/10/18 16:16:35 /home/me/Descargas/grav-admin/webserver-configs/Caddyfile:9 - Parse error: Wrong argument count or unexpected line ending after ‘status’

the line 9 in the Caddyfile is

rewrite {
r /(.git|cache|bin|logs|backups|tests)/.*$
status 403 <---- this is the line 9
}

for me seems than this is a compatibility error between different caddy’s versions…I’m using the latest caddy server

I’d appreciate if you can help me…thank so much

I rewrite the file to

:8080
gzip
fastcgi / 127.0.0.1:9000 php

# Begin - Security
# deny all direct access for these folders
rewrite {
    if {path} match    /(.git|cache|bin|logs|backups|tests)/.*$
    to /forbidden
}
# deny running scripts inside core system folders
rewrite {
    if {path} match       /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$
    to /forbidden
}
# deny running scripts inside user folder
rewrite { 
    if {path} match       /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$
    to /forbidden
}
# deny access to specific files in the root folder
rewrite {
    if {path} match        /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htacce ss.txt|\.htaccess)
    to /forbidden
}
## End - Security

# global rewrite should come last.
rewrite {
    to  {path} {path}/ /index.php?_url={uri}
}

but now I get this error


18/Oct/2016:16:26:14 -0400 [ERROR 502 /] dial tcp 127.0.0.1:9000: getsockopt: connection refused
18/Oct/2016:16:26:15 -0400 [ERROR 502 /index.php] dial tcp 127.0.0.1:9000: getsockopt: connection refused
18/Oct/2016:16:26:51 -0400 [ERROR 502 /index.php] dial tcp 127.0.0.1:9000: getsockopt: connection refused
18/Oct/2016:16:26:52 -0400 [ERROR 502 /index.php] dial tcp 127.0.0.1:9000: getsockopt: connection refused

I think than the last rewrite must be modified but not sure how could be it.

thank so much

Not really that familiar with Caddy. The configuration was user contributed. The configuration worked in prior version but now is broken in latest. I think @flaviocopes has made a request about format on the Caddy forum.

Not sure how 1.1.6 operates compared to previous few minor versions, but Caddy has changed fairly much since 0.8.x. It’s an excellent server for speed and simplicity - especially with Electron, so keeping an up-to-date example available would be handy.

Already tracked in https://github.com/getgrav/grav/issues/1115 - there is already a working edit there.

Need to check the best solution and submit a fix.

I change my fastcgi in the Caddyfile to

 fastcgi_pass 127.0.0.1:9000;

after that then I run

php-cgi -b 127.0.0.1:9000

and it works ok, now the caddyserver runs pretty good with the rewrites modified as I said before.