permission for var/www/html directory

ε祈祈猫儿з 提交于 2019-12-23 02:28:23

问题


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 ?


回答1:


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.




回答2:


I solved the problem by running this command

a2enmod rewrite

then restart apache server.

Thanks to everybody tryed to help me :)



来源:https://stackoverflow.com/questions/38894907/permission-for-var-www-html-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!