-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]
8
  • 1
    is your apache is compiled with PHP support on your micro instance? May 23 '13 at 16:24
  • 2
    Check /var/log/httpd/error.log.
    – ceejayoz
    May 23 '13 at 16:26
  • 1
    @AbhishekAnandAmralkar If he's editing /etc/httpd/conf.d/welcome.conf, he's using Apache, not nginx.
    – ceejayoz
    May 23 '13 at 16:26
  • 1
    @ceejayoz I have corrected my comment. May 23 '13 at 16:28
  • 1
    sudo tail /var/log/httpd/error_log will show you the last few lines of that file.
    – ceejayoz
    May 23 '13 at 17:52
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.

4
  • 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. 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.