5

I am setting up PHP environment. Now when I have started to add my sites from windows/xampp backup (mentioning so just in case any path related issue)

I have created new project (netbeans) and created test inedx.php and that I am able to access. However, When I am trying to access the site it is giving 403 Forbidden message for the site.

I am trying to resolve this since last night

  • on windows ? or on ubuntu ? – Edward Torvalds Dec 14 '14 at 7:40
  • I am having problem on Ubuntu. I am switching completely on Ubuntu from Windows – pixelngrain Dec 14 '14 at 12:23
  • I have changed permission again to 775 and now able to access the root of the site. But when I am trying access any page, it is giving 404 Not Found error. So I believe it is now mod rewrite issue. I have already enabled it. So do I need to write any code for mod rewrite? – pixelngrain Dec 14 '14 at 12:42
10

Try this solution

https://askubuntu.com/a/601722/392041

basically just replace

Order allow,deny
allow from all

with

Require all granted

You could find the reason for this here in this link http://httpd.apache.org/docs/2.4/howto/access.html

If you wish to restrict access to portions of your site based on the host address of your visitors, this is most easily done using mod_authz_host.

The Require provides a variety of different ways to allow or deny access to resources. In conjunction with the RequireAll, RequireAny, and RequireNone directives, these requirements may be combined in arbitrarily complex ways, to enforce whatever your access policy happens to be.

The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use.

8

Okay so after hitting hammer in my head, I found working properly. However I am not so sure if I have done correctly or there is any better approach to make it works.

What I have done first is, Change permission for entire /var/www again. I just wonder, why I have to reset it after pasting the site, I have done that before.

sudo chmod -R 775 /var/www

You may like to change group or owner etc..(also let me know if any good way to assign owner or group)

Than, I have added rewrite rule as below in..

sudo gedit /etc/apache2/sites-available/000-default.conf

Add below to 000-default.conf

<Directory /var/www/html>
  AllowOverride All
</Directory>

I checked and now everything is working fine.

Please, correct me or guide me if there is any better approach. I have just search here in some answers and apply simple logic to fix it. I am newbie and not good in all these.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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