0

I have installed apache2, php and mysql server to my ubuntu 14.04 and was tested and everything is working as expected.

I have application created using codeigniter & was past developed on mac osx, so I create the following in order to run it on my ubuntu:

create new site configuration file inside sites-available named payroll-v1.conf like below:

<VirtualHost *:80>
ServerName  payroll.v1
DocumentRoot /home/ahmed-saber/workspace/payroll-v1/

<Directory /home/ahmed-saber/workspace/payroll-v1/>
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory> 

</VirtualHost>

adding the line below to etc/hosts

127.0.0.1   payroll.v1

although my application not working and always output 403 forbidden even if i trying to access any static html page for test

3 Answers 3

2

The 403 error means that your pages are inaccessible for Apache.

Setting chmod -R 755 as you did, made it accessible for everybody on your system - every user, program, daemon etc. Furthermore, you have made all files executable this way (see this or this for mor info on permissions and executables on Linux).


More secure, yet simple solution, will be adding yourself to Apache's group (in Ubuntu its www-data) and then changing your Apache workspace to this group:

sudo adduser ahmed-saber www-data
sudo chown .www-data /home/ahmed-saber/workspace/
chmod 750 /home/ahmed-saber/workspace/

For more secure approach you could use Access Control List, which might be a little more complicated.

In situations like this, you can always check Apache's error log (/var/log/apache2/error.log). If you are developing web pages you can keep one terminal window opened with "live view" of logs (error.log or access.log or whatever), like this:

tail -f /var/log/apache2/error.log
1

You need to add a line

ServerName  payroll.v1

inside your VirtualHost definition to tell Apache the hostname used for this VirtualHost.

1
  • the line already there, I miss to write it here and I edited the question, but nothing going to be work Mar 18, 2015 at 12:17
0

The issue solved by running the following

sudo chmod -R 755 /home/ahmed-saber/workspace/*

also blank page due to some php errors

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .