Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Seems than there is an error running grav with caddy server

Started by Muut Archive 10 years ago · 6 replies · 1402 views
10 years ago

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

10 years ago

I rewrite the file to

GO
: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

BASH

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

10 years ago

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.

10 years ago

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.

10 years ago

Need to check the best solution and submit a fix.

10 years ago

I change my fastcgi in the Caddyfile to

TXT
 fastcgi_pass 127.0.0.1:9000;

after that then I run

BASH
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.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1357 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago