首先说明我的设置的一些细节:
我有以下工作 Nginx配置:
upstream fastcgi_backend {
server localhost:9000;
keepalive 30;
}
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
location ~ ^/(api|api-debug)/ {
root /app/webroot;
index index.php;
try_files $uri /api/index.php$is_args$args;
location ~ \.php$ {
fastcgi_pass fastcgi_backend;
fastcgi_split_path_info ^(?:\/api\/)(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /app/webroot/$fastcgi_script_name;
include fastcgi_params;
}
}
}
}
我只是想让它变得更加简单和有效,因为我现在看到的它是一团糟。 我试图调整例如
try_files $ uri /api/index.php$is_args$args;
到
try_files $ uri /api/webroot/index.php$is_args$args;
它失败了......唯一可行的原因是/api/index.php包含/api/webroot/index.php,但我觉得效率很低。
我发现调试nginx配置很难,因为它不容易测试。
非常感谢您的帮助!
答案 0 :(得分:0)
最简单的解决方案是将值为game.load.audio('background', ['assets/audio/background.wav'])
const backgroundSound = game.add.audio('background', 0.5, true) // here "true" means to loop
backgroundSound.play()
的SCRIPT_FILENAME硬连线并完全删除其中一个/app/webroot/index.php
块。
location
或者,为了保持指定具有location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location ~ ^/(api|api-debug)/ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /app/webroot/index.php;
fastcgi_pass fastcgi_backend;
}
扩展名的URI的灵活性,您可以使用以下方法简化配置:
.php