admin管理员组文章数量:1202361
I deployed a CakePHP v4.5
application on AWS Elastic Beanstalk
. The deployment was successful, and the environment status was set to "OK". However, when testing the application through the link provided by AWS, I encountered an issue:
The root route (/
) works perfectly, but accessing any other route results in a 404 Not Found
error.
After checking the logs, I found the following error message whenever a 404 is triggered:
[error] 26495#26495: *25 open() "/var/www/html/webroot/painel" failed (2: No such file or directory)
Based on some research, I created a custom configuration for Nginx by adding the file
.platform/nginx/conf.d/custom.conf
to the root directory of the project. The file content was as follows:
location /{try_files $uri $uri/ /index.php?$query_string; }
However, after adding this configuration and deploying the application, the deployment failed and produced the following error:
[ERROR] An error occurred during execution of command [app-deploy] - [start proxy with new configuration]. Stop running the command.
Error: copy proxy conf from staging failed with error validate nginx configuration failed with error Command /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf failed with error exit status 1.
Stderr:nginx: [emerg] open() "/var/proxy/staging/nginx/fastcgi_params" failed (2: No such file or directory) in /var/proxy/staging/nginx/conf.d/custom.conf:13 nginx: configuration file
/var/proxy/staging/nginx/nginx.conf test failed
Additionally, the AWS environment variable for the project root is set to /webroot.
I deployed a CakePHP v4.5
application on AWS Elastic Beanstalk
. The deployment was successful, and the environment status was set to "OK". However, when testing the application through the link provided by AWS, I encountered an issue:
The root route (/
) works perfectly, but accessing any other route results in a 404 Not Found
error.
After checking the logs, I found the following error message whenever a 404 is triggered:
[error] 26495#26495: *25 open() "/var/www/html/webroot/painel" failed (2: No such file or directory)
Based on some research, I created a custom configuration for Nginx by adding the file
.platform/nginx/conf.d/custom.conf
to the root directory of the project. The file content was as follows:
location /{try_files $uri $uri/ /index.php?$query_string; }
However, after adding this configuration and deploying the application, the deployment failed and produced the following error:
[ERROR] An error occurred during execution of command [app-deploy] - [start proxy with new configuration]. Stop running the command.
Error: copy proxy conf from staging failed with error validate nginx configuration failed with error Command /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf failed with error exit status 1.
Stderr:nginx: [emerg] open() "/var/proxy/staging/nginx/fastcgi_params" failed (2: No such file or directory) in /var/proxy/staging/nginx/conf.d/custom.conf:13 nginx: configuration file
/var/proxy/staging/nginx/nginx.conf test failed
Additionally, the AWS environment variable for the project root is set to /webroot.
1 Answer
Reset to default 0It seems like /var/proxy/staging/nginx/fastcgi_params
file is missing. You are referencing properties $uri
and $query_string
which could be located there.
Maybe you should try this: https://github.com/nginx/nginx/blob/master/conf/fastcgi_params
本文标签: amazon web servicesCannot configure any route aside from rootStack Overflow
版权声明:本文标题:amazon web services - Cannot configure any route aside from root - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738603197a2102192.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论