简体   繁体   中英

permission for var/www/html directory

I installed ubuntu server 14.04 then (apache,php and mysql). I uploaded my website to /var/www/html and nuzip it and linked it to database. When I request my ip in the browser i get the home page, but when click on any url in the site it returns 404 not found error - not from my website- but from the server. I searched but problem not solved this is what i tryed

chmod -R g+w /var/www/html
chown -R $user:$user /var/www/html/
chown -R www-data:www-data /var/www/html/

but non of this works. any idea ?

If you are using Laravel, please keep in mind that you have to separate "public" folder and the app itself.

First of all, go to /var/www and create folder called "app".

Put everything in here excluding public folder.

Contents of public folder goes to /var/www/html . Now, edit routes in /var/www/html/index.php

From __DIR__.'/../bootstrap/app.php to ../app/bootstrap/app.php

Do the same with other routes in here.

Don't forget to change the permissions. The easiest way would be to set it to 777 for the whole /var/www using sudo chmod -R 777 /var/www

Good luck.

I solved the problem by running this command

a2enmod rewrite

then restart apache server.

Thanks to everybody tryed to help me :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM