[英]permission for var/www/html directory
I installed ubuntu server 14.04 then (apache,php and mysql). 我安装了ubuntu服务器14.04然后(apache,php和mysql)。 I uploaded my website to /var/www/html and nuzip it and linked it to database.
我将我的网站上传到/ var / www / html并对其进行nuzip并将其链接到数据库。 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.
当我在浏览器中请求我的IP时,我获得了主页,但是当点击网站中的任何网址时,它返回404未找到错误 - 不是来自我的网站 - 而是来自服务器。 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. 如果您使用的是Laravel,请记住,您必须将“public”文件夹和应用程序本身分开。
First of all, go to /var/www
and create folder called "app". 首先,转到
/var/www
并创建名为“app”的文件夹。
Put everything in here excluding public folder. 将所有内容放在此处,不包括公用文
Contents of public folder goes to /var/www/html
. 公用文件夹的内容转到
/var/www/html
。 Now, edit routes in /var/www/html/index.php
现在,在
/var/www/html/index.php
编辑路线
From __DIR__.'/../bootstrap/app.php
to ../app/bootstrap/app.php
从
__DIR__.'/../bootstrap/app.php
到../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
最简单的方法是使用
sudo chmod -R 777 /var/www
将整个/ var / www设置为777
Good luck. 祝好运。
I solved the problem by running this command 我通过运行此命令解决了这个问题
a2enmod rewrite
then restart apache server. 然后重启apache服务器。
Thanks to everybody tryed to help me :) 感谢大家试着帮助我:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.