CodeIgniter Forums
Deploying Codeigniter to AWS EBS - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Deploying Codeigniter to AWS EBS (/showthread.php?tid=68033)

Pages: 1 2


Deploying Codeigniter to AWS EBS - RedRepublic01 - 05-13-2017

Hello everyone,

So basically I have this website that I've literally slaved over the last 3 months. I tried it using the localhost (XAMPP) and it works like a beauty. I thought I'd give AWS EBS a shot.

I created an instance and I uploaded the website files (.ZIP file - application folder, system folder, assets folder, and .htaccess). However it keeps throwing me a "Forbidden you do not have permission to access / on this server" error.

I've already tried changing the base url in the config file but to no avail. Any help would be most appreciated.


RE: Deploying Codeigniter to AWS EBS - eflyerman - 05-13-2017

Define "It". Does "It" mean an HTTP 403 error in the browser or do you mean the OS when you try to unzip your zip files?

What is your platform ? Ubuntu Xenian/Apache2, Redhat, Centos?


E


RE: Deploying Codeigniter to AWS EBS - RedRepublic01 - 05-13-2017

(05-13-2017, 05:06 PM)eflyerman Wrote: Define "It".  Does "It" mean an HTTP 403 error in the browser or do you mean the OS when you try to unzip your zip files?

What is your platform ?  Ubuntu Xenian/Apache2, Redhat, Centos?


E

It's an HTTP 403 error upon accessing the sample URL generated from the deployed instance of the website. I'm using a Windows laptop to do this.


RE: Deploying Codeigniter to AWS EBS - ciadmin - 05-13-2017

403 means "forbidden". It is usually caused by incorrect file/folder permissions on the server.


RE: Deploying Codeigniter to AWS EBS - RedRepublic01 - 05-13-2017

(05-13-2017, 10:01 PM)ciadmin Wrote: 403 means "forbidden". It is usually caused by incorrect file/folder permissions on the server.

I've already tried changing both the config and the .htaccess file to allow access but the same error keeps on showing up. Sad


RE: Deploying Codeigniter to AWS EBS - Paradinight - 05-13-2017

(05-13-2017, 10:38 PM)RedRepublic01 Wrote:
(05-13-2017, 10:01 PM)ciadmin Wrote: 403 means "forbidden". It is usually caused by incorrect file/folder permissions on the server.

I've already tried changing both the config and the .htaccess file to allow access but the same error keeps on showing up. Sad

https://www.tutorialspoint.com/unix/unix-file-permission.htm

each file/folder need the execute flag Smile


RE: Deploying Codeigniter to AWS EBS - RedRepublic01 - 05-13-2017

(05-13-2017, 10:51 PM)Paradinight Wrote:
(05-13-2017, 10:38 PM)RedRepublic01 Wrote:
(05-13-2017, 10:01 PM)ciadmin Wrote: 403 means "forbidden". It is usually caused by incorrect file/folder permissions on the server.

I've already tried changing both the config and the .htaccess file to allow access but the same error keeps on showing up. Sad

https://www.tutorialspoint.com/unix/unix-file-permission.htm

each file/folder need the execute flag Smile
I'm using a Windows laptop. Sad
Are you talking about the AWS platform?

Save


RE: Deploying Codeigniter to AWS EBS - Diederik - 05-14-2017

(05-13-2017, 10:51 PM)Paradinight Wrote:
(05-13-2017, 10:38 PM)RedRepublic01 Wrote:
(05-13-2017, 10:01 PM)ciadmin Wrote: 403 means "forbidden". It is usually caused by incorrect file/folder permissions on the server.

I've already tried changing both the config and the .htaccess file to allow access but the same error keeps on showing up. Sad

https://www.tutorialspoint.com/unix/unix-file-permission.htm

each file/folder need the execute flag Smile

No, php files do not need execution flags, apache (or other webserver software) needs to be able to read them. But this is not related to the issue of the topic starter.

I think you are uploading files to the wrong directory. Try uploading a simple test.html to thE folder and try to acces it with your browser. If you dont see it, please check your apache access logs, I believe apache shows a full path in the error log when a file is not accesible.


RE: Deploying Codeigniter to AWS EBS - eflyerman - 05-14-2017

I can't tell from the thread. In your first post you said AWS EBS but then a later post you said windows laptop. If it's AWS are you using an EC2 instance with EBS device or Elastic Beanstalk? I haven't used the Beanstalk yet so I can't help you there. Since I can only guess, here's some generic info on AWS hosting.

If you are using EBS and not Beanstalk you need to issue the commands to set the owner and permissions of the web files. You said you were using AWS. I am going to assume Ubuntu/Apache just because its the most common and I'm more familiar with it. Not a dis against the other distros but the details will vary by linux dist. These commands will work with Ubuntu and Apache2. If you're using Centos/Redhat/Suse or any of the other distros the default users and locations will differ.

Your default userid will not have authority to change owners and permissions but *nix gives you a special permissions command called sudo.

sudo chmod -R 0755 /var/www/html
sudo chown -R root:www-data /var/www/html

(var/www/html) is the default apache2 installation location. If you are indeed using EBS, this will need to be the filesystem mount point for the EBS device.

First in the /etc/apache2/sites-available/000-default.conf contains an entry for DocumentRoot. By default it is set to /var/www/html. If you want to use EBS you'll want to use the AWS control panel to create an EBS volume separate from your running instance, allocate it to your EC2 instance and finally mount the volume somewhere on the filesystem.

sudo mount /dev/sd0 /s3

mountcopy your files to a folder under /s3 like /s3/wwwroot

Also need to change the /etc/fstab file to auto mount the device after a reboot

In my case, EBS used to be call Simple Storage Solution or S3. My ebs volume is mounted as /S3. You can created a folder under /S3/wwwroot and change the DocumentRoot setting to point to the new folder.

On Ubuntu the default installation of Apache runs as user www-data. The system user is ubuntu. You have to change the owner and file permissions.


RE: Deploying Codeigniter to AWS EBS - RedRepublic01 - 05-14-2017

(05-14-2017, 01:12 PM)eflyerman Wrote: I can't tell from the thread.  In your first post you said AWS EBS but then a later post you said windows laptop.  If it's AWS are you using an EC2 instance with EBS device or Elastic Beanstalk?  I haven't used the Beanstalk yet so I can't help you there.  Since I can only guess, here's some generic info on AWS hosting.

If you are using EBS and not Beanstalk you need to issue the commands to set the owner and permissions of the web files.  You said you were using AWS.  I am going to assume Ubuntu/Apache just because its the most common and I'm more familiar with it.  Not a dis against the other distros but the details will vary by linux dist.  These commands will work with Ubuntu and Apache2.  If you're using Centos/Redhat/Suse or any of the other distros the default users and locations will differ.  

Your default userid will not have authority to change owners and permissions but *nix gives you a special permissions command called sudo.

sudo chmod -R 0755 /var/www/html  
sudo chown -R root:www-data /var/www/html

(var/www/html) is the default apache2 installation location.  If you are indeed using EBS, this will need to be the filesystem mount point for the EBS device.

First in the /etc/apache2/sites-available/000-default.conf contains an entry for DocumentRoot.  By default it is set to /var/www/html.  If you want to use EBS you'll want to use the AWS control panel to create an EBS volume separate from your running instance, allocate it to your EC2 instance and finally mount the volume somewhere on the filesystem.
 
sudo mount /dev/sd0 /s3

mountcopy your files to a folder under /s3 like /s3/wwwroot

Also need to change the /etc/fstab file to auto mount the device after a reboot

In my case, EBS used to be call Simple Storage Solution or S3.  My ebs volume is mounted as /S3. You can created a folder under /S3/wwwroot and change the DocumentRoot setting to point to the new folder.

On Ubuntu the default installation of Apache runs as user www-data.  The system user is ubuntu.  You have to change the owner and file permissions.

I apologize. All this time, I thought Elastic Beanstalk and EBS were the same. Sorry. 

Anyway, just so you know my current setup, I'm using a Windows laptop to upload the Codeigniter website files to the AWS Elastic Beanstalk instance. I've tried everything from deleting my .htaccess files to modifying the config file to solve the 403 HTTP error but to no avail.