在Apache + mySQL环境中的AWS EC2上找不到Laravel ReST API URL 404

编程入门 行业动态 更新时间:2024-10-19 15:34:38
本文介绍了在Apache + mySQL环境中的AWS EC2上找不到Laravel ReST API URL 404-在此服务器上找不到请求URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这个问题是关于Apache + mySQL AWS EC2实例上的AWS Laravel实现的.

This question is on AWS Laravel Implementation on Apache + mySQL AWS EC2 instance.

从xampp/htdocs/my_project_name复制可工作的Laravel文件夹后,迁移工作已在mySQL数据库和种子服务器中创建表. 但是,我无法使用Postman连接到我的API. (找不到404)

After copying the working Laravel folder from xampp/htdocs/my_project_name, migration to create tables in mySQL database and seeder are working. However, I could not connect to my APIs using Postman. (404 not found)

我关注这些解决方案链接 laravel在此服务器上找不到请求的URL laracasts/discuss/channels/general-discussion/laravel-5-the-requested-url-was-not-found-on-this-server

I following these solution links laravel the requested url was not found on this server laracasts/discuss/channels/general-discussion/laravel-5-the-requested-url-was-not-found-on-this-server

我设法修改了httpd.conf.但是,我找不到文件.htaccess (

I managed to modify the httpd.conf. However, I could not find file .htaccess (

我在哪里可以找到.htacces?抱歉,您遇到了愚蠢的问题,但我找不到:) – MilanNz '15 Mar 11 '15 at 12:30 @MilanNz .htaccess可以在应用程序的公共目录中找到.但是,此答案中的代码位于vhost文件中.该位置取决于您的服务器. (例如,对于apache2和unix,通常位于/etc/apache2/sites-available)

where .htacces i can find? Sorry for stupid question, but i can't find :) – MilanNz Mar 11 '15 at 12:30 @MilanNz The .htaccess can be found in the public directory of your application. However the code from this answer goes inside a vhost file. The location of that depends on your server. (e.g. for apache2 and unix it's usually at /etc/apache2/sites-available)

)

此外,我无法使用"service apache2 restart"重新启动Apache. 因此,我"sudo重新启动"了EC2实例并使用Postman重新连接,仍然找不到API网址.

Also, I was not able to reboot my Apache using "service apache2 restart". So I "sudo reboot"ed the EC2 instance and reconnected using Postman, the API urls were still not found.

我的网址有可能是错误的.所以我在这里附上: 使用的URL是 ec2- ??-??-???-???-?? .us-east-2pute.amazonaws/my_project_name/public/api/resultCRUD/list 有效的xampp URL为 localhost/my_project_name/public/api/resultCRUD/list

There is a possibility that my URL is wrong. So I attach it here: The URL used is ec2-??-??-???-??.us-east-2pute.amazonaws/my_project_name/public/api/resultCRUD/list The working xampp URL is localhost/my_project_name/public/api/resultCRUD/list

Laravel项目文件夹位于AWS EC2上的/var/www/html/my_project_name.

The Laravel project folder is located at /var/www/html/my_project_name on AWS EC2.

ec2- ??-??-??-???-?? .us-east-2pute.amazonaws/phpinfo.php 和 ec2-??-??-??-???-??.us-east-2pute.amazonaws/phpMyAdmin/正常工作.

任何帮助将不胜感激.谢谢!

Any help is greatly appreciated. Thanks!

推荐答案

终于可以了. 我被困的原因是,当我使用RedHat时,大多数答案都是针对ubuntu的. 对于RedHat EC2实例,首先需要遵循 pinecode.io/article/setting-up-laravel-56-on-aws-linux , 在此步骤中,我实际上将所有"AllowOverride None"更改为"AllowOverride All",而不是仅将httpd.conf的第151行.

It's finally working. The reason I was stuck is because most of the answers are for ubuntu while I am using RedHat. For RedHat EC2 instance, need first change the content of /etc/httpd/conf/httpd.conf following pinecode.io/article/setting-up-laravel-56-on-aws-linux, In this step, I actually changed all "AllowOverride None"s to "AllowOverride All" instead of only line 151 of httpd.conf.

然后需要使用sudo服务重新启动httpd httpd restart 关注 gistpages/posts/enable_mod_rewrite_in_apache2_on_red_hat_linux

Then need to restart httpd using sudo service httpd restart following gistpages/posts/enable_mod_rewrite_in_apache2_on_red_hat_linux

然后一切正常.

当我问这个问题时,将更改保存到httpd.conf后,我没有重新启动apache服务.

I didn't restart my apache service after saving changes to httpd.conf when I was asking this question.

更多推荐

在Apache + mySQL环境中的AWS EC2上找不到Laravel ReST API URL 404

本文发布于:2023-10-31 16:01:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546576.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   环境   AWS   mySQL   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!