-1

My CodeIgniter app is working fine in WAMP using http://localhost/myapp

However, I'm getting a blank page on my Amazon EC2 micro instance using http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/myapp .

Also, I still get the Amazon Linux AMI Test page using this link: (I commented out contents of welcome.conf): http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com

My question is: what changes do I need to make in order to get my CodeIgniter application to work on my EC2 micro instance? My application does not use a database. It just queries the Twitter API and returns the results.

Here is what I've done so far:

  1. I uploaded my CodeIgniter app to the /var/www/html directory of my Amazon EC2 micro instance with no errors using FileZilla.
  2. I also tried to disable the Amazon Linux AMI Test page by commenting out the following lines in /etc/httpd/conf.d/welcome.conf

LocationMatch "^/+$" Options -Indexes Errordocument 403 /error/noindex.html /LocationMatch

EDIT 1 In my CodeIgniter root directory, I have a .htaccess file (see below). Do I have to do a similar configuration in my EC2 instance inorder to access my CI home page?:

RewriteEngine On

# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/

RewriteBase /myapp

# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
Anthony
  • 201
  • 1
  • 6
  • 12

1 Answers1

1

Put below lines in the httpd.conf

  AddType application/x-httpd-php .php .phtml
  AddType application/x-httpd-php-source .phps

and restart apache afterward

Fond out below line in apache config

  Options Indexes FollowSymLinks

make it

  Options -Indexes FollowSymLinks

This will disable directory listing under your apache.

  • 1
    If he's getting a blank page (and not raw PHP source code), PHP is likely to be properly enabled, and he's just getting a 500 error due to some sort of misconfiguration. – ceejayoz May 23 '13 at 16:30
  • +1 Thank you very much for your reply Abhishek. I entered the lines in the httpd.conf and restarted Apache (sudo httpd -k restart). Unfortunately, the page is still blank using `http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/myapp`. Interesting though, I'm not getting the Amazon AMI Test Page from `http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/` anymore. I'm getting an "Index of" page which displays my "myapp" folder. When I open it, the page is blank. – Anthony May 23 '13 at 17:27
  • 1
    I have edited my answer please check. – Abhishek Anand Amralkar May 23 '13 at 17:31
  • +1 Thanks Abhishek. It worked. I'm now getting a Permission Denied message from `http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/` However, see EDIT 1 in my question above. I've included the .htaccess file thats in my CodeIgniter root directory and was wondering if I have to do something similar in EC2 in order to display my application using `http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/myapp`. – Anthony May 23 '13 at 18:33