• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deploying Codeigniter to AWS EBS

#1
Brick 
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.
Reply

#2
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
Reply

#3
(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.
Reply

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

#5
(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
Reply

#6
(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...ission.htm

each file/folder need the execute flag Smile
Reply

#7
(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...ission.htm

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

Save
Reply

#8
(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...ission.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.
Reply

#9
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.
Reply

#10
(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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.