panique / mini

Just an extremely simple naked PHP application, useful for small projects and quick prototypes. Some might call it a micro framework :)
1.35k stars 479 forks source link

Error 403 from the begining #199

Closed khru closed 8 years ago

khru commented 8 years ago

I've just install mini, and it happens that some how when I access 192.168.33.44 apache shows a 403 forbbiden message.

This is my site configuration:

<VirtualHost *:80>
    DocumentRoot "/var/www/html/myproject/public"
    <Directory "/var/www/html/myproject/public">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

The rewrite mod is enabled.

If I disabled the site, I can access to the server but not to the myproject folder.

panique commented 8 years ago

Have you used the auto-installer ? and please give some details on your OS etc

khru commented 8 years ago

I've used Vagrant 100% autoinstaller, and my OS is Ubuntu 14.04 x64.

I've also have tried to replace from .htaccess -"Indexes" to "+Indexes"

khru commented 8 years ago

I think I see the problem:

drwx------  1 vagrant vagrant 4096 Dec  9 11:04 html
drwxrwxr-x 1 vagrant vagrant  4096 Dec  9 11:05 myproject

I believed that the owner must be www-data

So i tried this:

  # Share an additional folder to the guest VM. The first argument is the path on the host to the actual folder.
  # The second argument is the path on the guest to mount the folder.
  config.vm.synced_folder "./", "/var/www/html",
  owner: "www-data",
  group: "www-data",
  mount_options: ["dmode=775,fmode=775"]

and I fix it

khru commented 8 years ago

Becuse i've changed the permissions composer doesn't work...

panique commented 8 years ago

Hey, thanks for the feedback!

I think you are right, this was also a problem in another project that used nearly the same auto-installer, and there's I've fixed it by replacing

# create project folder
sudo mkdir "/var/www/html/${PROJECTFOLDER}"

with

# Create project folder, written in 3 single mkdir-statements to make sure this runs everywhere without problems
sudo mkdir "/var/www"
sudo mkdir "/var/www/html"
sudo mkdir "/var/www/html/${PROJECTFOLDER}"

I cannot explain exactly why and how this works better, but it does in lots of installation of HUGE (https://github.com/panique/huge/blob/master/_one-click-installation/bootstrap.sh), therefore it should be the same for MINI.

I've changed this now in develop and master branch inside this project here, please gimme some time for testting ! :)