Issue running an app on a cloned AWS EC2 instance - php

I have an application (php/node.js/mysql) running on a fully configured EC2 instance, using elastic beanstalk connected to an RDS DB. I tried to recreate that instance and run a test application and it didn't work, I though it might be something with the config of the instance, so I cloned the instance that is running correctly and tried to run the test app (which is exactly like the prod app) and I get this error: DNS_PROBE_FINISHED_NXDOMAIN
It has nothing to do with my internet connection, which is working fine. A couple of facts:
1- when I run the app on the instance I created, it does load the index.html page, but does not connect to any other page (this is a php/node.js/mysql app), and I get error 404.
2- when I try to load the url in the second (cloned) case, the subdomain I created, receives a www from the browser and gives me the error above. This could be some kind of wrong config on my godaddy, but it gives me no error when I try it on the created instance.
I'm having a hard time trying to figure this out, can someone shed some light pls?
Thanks all!

Related

Why's my Laravel website throwing CORS error while deployed on Elastic Beanstalk?

Just to preface: the website works as intended while running it on localhost
I've deployed my Laravel website to Elastic Beanstalk and I've configured the EC2 instance accordingly as well populated RDS with sufficient data.
The endpoints that live in the api.php file that are being called on the React.js frontend are all hard coded. For example, http://127.0.0.1:8000/api/login.
I did the obvious:
replaced the endpoint URL with the new Elastic Beanstalk URL. I.e. -
http://myapp.something.us-east-1.elasticbeanstalk.com/api/login.
On the server while ssh'd in, I also changed the .env file's value of
APP_URL to http://myapp.something.us-east-1.elasticbeanstalk.com/
But despite doing these, I get a CORS issue. It looks like the website is still somehow pointing to localhost.
How can I make it so that the website talks to the new Elastic Beanstalk URL hits the endpoints correctly?

Laravel pagination is not working after deploying it on AWS EC2 Sever

Laravel pagination not working properly after deploying the app on AWS EC2 server. It was working fine on the localhost using Xampp server. In the localhost, MySQL was used as the database whereas in AWS server Aurora MySQL database is used. It is basically a reporting page were the first page loads properly but whenever any other page is clicked from the below pagination links it shows loading for a long time then fails with the message "This site can’t be reached". In the AWS EC2 server, Nginx is used. Can anyone help me solving this issue?
Thank you
I have found out the solution of the problem. The pagination pages were not https. As a result, it was not supporting. I used forced https which was working perfectly for other URLs but was not working for paginations. I used $users->setPath(''); after each paginate command to make those URL https. After taking the above-mentioned step, it worked properly. Thank you

How to connect to Directus API in localhost

I am trying to setup directus in my website. Since my website is now at localhost I want to connect to API to get database info. I don't know where to point my endpoints in localhost.
My Ampps local server config is
Apache:7.1
sql:5.7.17
Till now I installed composer, then I tried to ping
doc example https://example.com/server/ping
I used https://localhost/server/ping
my directus is located in C:\Program Files (x86)\Ampps\www\trial\directus-master
what will be https://example.com
getting 404 error everytime.
Could you elaborate more, your question is vague with missing information.
Are you saying you have Directus setup on a server, and now you've loaded your website up locally, you want to access that remote instance?
If so, then you need to send your queries to the remote server.
Much like:
https://demo-api.directus.app/server/ping
https://demo-api.directus.app/_/items/sales/1,2,3

Wordpress white screen when launching from AWS EC2 AMI

I've created an AWS EC2 instance with a Wordpress site running on it. The MySQL database is on Amazon RDS and everything works perfectly. I've created an image from the EC2 instance and a snapshot from the RDS instance and attempted to bring up the site using the new instances but I keep getting a blank white screen. I can connect to the new RDS instance using MySQL Workbench so it looks like it's running. I can open up a phpinfo.php page on the EC2 instance so it looks like the web server is running. I've modified the wp-config.php file to point to the new RDS instance and changed the DOMAIN_CURRENT_SITE to point to the new EC2 instance. Still getting a blank screen. Any other options I can try? I've set WP_DEBUG to true but I don't get any error messages. Any help would be greatly appreciated.
thanks.
In my experience White Screens are commonly database issues.
Ensure you're connecting correctly and that the WordPress database is correct.
At a guess of the most likely problem; your /wp-config.php should contain the correct database hostname instance-name.randomcode.amazon-region.rds.amazonaws.com as opposed to localhost. This is because if you're running an RDS instance for your database it's a different server and than your AWS instance. This means it's not on the AWS localhost.
For more info the AWS docs are usually somewhat helpful. You can find them here

PHP pages not showing in AWS Elastic Beanstalk

So I'm trying to deploy my first application on AWS Elastic Beanstalk, but I'm having some issues.
When I try to go to my php pages, a blank page is pulled up in the web browser. However all the html pages on my app are pulling fine (although they aren't styled). Anyone have any ideas why that is?
FYI: I'm not sure if I am connecting to my database instance on RDS correctly.
You need to pinpoint the issue via the logs. Go to your Elastic Beanstalk console and request the full logs. Once you got this zip you'll probably find an error in the directory-hooks-executor.log file (or any other file).
Sorry I figured it out! I didn't know that URL's past the top level domain were case-sensitive for Linux. I had one letter that wasn't the correct capitalization on my files.

Categories