CodeIgniter Forums

Full Version: Codeigniter Website Showing Blank Page in AWS Elastic Beanstalk
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Okay, I've managed to fix my previous problem (https://forum.codeigniter.com/thread-68033.html) regarding the 403 Error popping up whenever I deploy my Codeigniter website to the AWS Elastic Beanstalk. I just tweaked the .htaccess file and the error was solved.

Before anything else, this is the structure of the entire site


myAppFolder
   -> application (contains config file)
   -> assets
   -> system
index.php
.htaccess

However, this time, the website just shows a blank page. My config file's base url has already been set to

xxxxxxx-xxx.xxxxxxxxxx.xx-xxxx-x.xxxxxxxxxxxxxxxx.com/myAppFolder/


When I run it using XAMPP, it works fine and displays the home page. I'm just puzzled as to why after uploading it to elastic beanstalk, it's showing nothing.

Thanks in advance,
Unless you are moving it to an environment 100% like the one you tested, things like this happen. A blank page can mean several things such as Apache works, but it isn't being routed correctly or there is a PHP error and the php.ini is set to not show errors. Time to troubleshoot by looking at the access/error logs for Apache.

I'm assuming you set the DirectoryIndex appropriately?
(05-16-2017, 05:42 AM)xenomorph1030 Wrote: [ -> ]Unless you are moving it to an environment 100% like the one you tested, things like this happen. A blank page can mean several things such as Apache works, but it isn't being routed correctly or there is a PHP error and the php.ini is set to not show errors. Time to troubleshoot by looking at the access/error logs for Apache.

I'm assuming you set the DirectoryIndex appropriately?

That would be my guess. I use opsworks instead of EBS but I would check to see if you're launching in a production env that is suppressing errors.
(05-16-2017, 05:42 AM)xenomorph1030 Wrote: [ -> ]Unless you are moving it to an environment 100% like the one you tested, things like this happen. A blank page can mean several things such as Apache works, but it isn't being routed correctly or there is a PHP error and the php.ini is set to not show errors. Time to troubleshoot by looking at the access/error logs for Apache.

I'm assuming you set the DirectoryIndex appropriately?

Yes, I've already set the DirectoryIndex in the .htaccess file.

I've tried getting the IPv4 public IP of my Elastic Beanstalk instance and pasting that to the base_url of the config file. However when I did that, it still returned a blank page.

Am I missing something else?
base_url should not include myAppFolder it should just be your domain name with a trailing /. If your index.php is not in a folder in the bundle you are pushing, go to you EB config -> software configuration and set the following;

document root: /
environment properties: key CI_ENV value production

On the server this is where your files are:

/var/app/current/index.php
/var/app/current/.htaccess
/var/app/current/myAppFolder
/var/app/current/myAppFolder/system
...

Apache serves /var/app/current + your document root set in the control panel.
(05-16-2017, 07:35 AM)spjonez Wrote: [ -> ]base_url should not include myAppFolder it should just be your domain name with a trailing /. If your index.php is not in a folder in the bundle you are pushing, go to you EB config -> software configuration and set the following;

document root: /
environment properties: key CI_ENV value production

On the server this is where your files are:

/var/app/current/index.php
/var/app/current/.htaccess
/var/app/current/myAppFolder
/var/app/current/myAppFolder/system
...

Apache serves /var/app/current + your document root set in the control panel.

Okay so I've set it back to http://xxxxxxx-xxx.xxxxxxxxxx.xx-xxxx-x....xxxxxxxxx/
in the config file. I've also set the doc root and env properties.

It's still returning a blank page. Sad
Pull the logs from the EB control panel and see what it's doing. You may want to turn on show errors in your software config in EB. Or you can SSH into the box and run this:

wget -O - localhost

Logs are in /var/log/httpd

Is that giant pile of x's your domain name, like http://www.example.com/ ?
(05-16-2017, 08:10 AM)spjonez Wrote: [ -> ]Pull the logs from the EB control panel and see what it's doing. You may want to turn on show errors in your software config in EB. Or you can SSH into the box and run this:

wget -O - localhost

Logs are in /var/log/httpd

Is that giant pile of x's your domain name, like http://www.example.com/ ?

The giant pile of x's consist of the URL generated by the environment instance in Elastic Beanstalk.

I really don't get why this is happening. I've run all tests on my localhost and it works perfectly. Sad

I also followed AWS instructions and archived the entire project into a .ZIP file.
(05-16-2017, 06:32 PM)RedRepublic01 Wrote: [ -> ]
(05-16-2017, 08:10 AM)spjonez Wrote: [ -> ]Pull the logs from the EB control panel and see what it's doing. You may want to turn on show errors in your software config in EB. Or you can SSH into the box and run this:

wget -O - localhost

Logs are in /var/log/httpd

Is that giant pile of x's your domain name, like http://www.example.com/ ?

The giant pile of x's consist of the URL generated by the environment instance in Elastic Beanstalk.

I really don't get why this is happening. I've run all tests on my localhost and it works perfectly. Sad

I also followed AWS instructions and archived the entire project into a .ZIP file.

That's the internal network name on AWS not your base url. If you're using a different domain in local and production set it to this:

Code:
$config['base_url'] = 'http' . (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . '/';

The logs in AWS will tell you what's happening if you haven't setup eb-cli to SSH into it yet. If you're trying to access the site under HTTPS you need to update your Elastic Load Balancer with port 443 it's not on by default.

If you can post your error/access logs them I can take a look for you.
(05-18-2017, 10:27 AM)spjonez Wrote: [ -> ]
(05-16-2017, 06:32 PM)RedRepublic01 Wrote: [ -> ]
(05-16-2017, 08:10 AM)spjonez Wrote: [ -> ]Pull the logs from the EB control panel and see what it's doing. You may want to turn on show errors in your software config in EB. Or you can SSH into the box and run this:

wget -O - localhost

Logs are in /var/log/httpd

Is that giant pile of x's your domain name, like http://www.example.com/ ?

The giant pile of x's consist of the URL generated by the environment instance in Elastic Beanstalk.

I really don't get why this is happening. I've run all tests on my localhost and it works perfectly. Sad

I also followed AWS instructions and archived the entire project into a .ZIP file.

That's the internal network name on AWS not your base url. If you're using a different domain in local and production set it to this:

Code:
$config['base_url'] = 'http' . (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . '/';

The logs in AWS will tell you what's happening if you haven't setup eb-cli to SSH into it yet. If you're trying to access the site under HTTPS you need to update your Elastic Load Balancer with port 443 it's not on by default.

If you can post your error/access logs them I can take a look for you.

Still returns a blank page... Sad
Gonna attach the logs here... so frustrated Sad


Save
Save
Pages: 1 2