我试着安装api-platform:https://api-platform.com/docs/distribution/
启动后我在日志中看到“api-platform-242_cache-proxy_1”
│ Error: │
│ Message from VCC-compiler: │
│ Expected return action name. │
│ ('/usr/local/etc/varnish/default.vcl' Line 67 Pos 13) │
│ return (miss); │
│ ------------####-- │
│ Running VCC-compiler failed, exited with 2 │
│ VCL compilation failed
如果我使用api(post greeting),响应代码为500“hydra:description”:“cURL错误6:无法解析主机:cache-proxy(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)”,“trace”:[
然而,该实体仍然插入。
此外,我尝试了没有docker(Apache)的api平台。我删除了.env文件中的VARNISH_URL = http://cache-proxy行。然后返回代码为500,“cURL错误3:格式错误(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)”
你有什么主意吗?
亲切的问候鲁迪
从api_platform.yaml中删除清漆
我相信你应该从VARNISH_URL=http://cache-proxy
文件中删除或注释.env
而不是api_platform.yaml
,因为你的.env
可以改变并且/应该是主机依赖和配置(.yaml
)不应该。
见:https://symfony.com/doc/current/configuration.html#the-env-file-environment-variables
还有一个.env文件被加载,其内容成为环境变量。这在开发期间很有用,或者如果您的部署很难设置环境变量。
在api_platform.yaml
你应该评论整个http_cache
部分,否则你将继续得到关于guzzle错误的cURL错误。
{ "@context": "/api-platform/api/public/contexts/Error", "@type": "hydra:Error", "hydra:title": "An error occurred", "hydra:description": "cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)", "trace": [ { "namespace": "", "short_class": "", "class": "", "type": "", "function": "", "file": "...\\api-platform\\api\\vendor\\guzzlehttp\\guzzle\\src\\Handler\\CurlFactory.php", "line": 186, "args": [] },
效果是一样的。
我有同样的问题,我解决了!
如下所示:https://github.com/api-platform/api-platform/issues/777,问题是目录/文件权限,所以我没有下载zip或tar.gz存档,而是克隆了repo,
我做的所有命令(在安装Docker for Windows并在Docker for Windows设置中启用共享驱动器之后):
cd my_parent_directory
git clone https://github.com/api-platform/api-platform.git
cd api-platform
docker-compose pull
docker-compose up -d
当我继续https://localhost:8443所有的工作!
我希望这可以帮助你 :)