简体   繁体   English

var / www / html目录的权限

[英]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.

相关问题 Laravel 错误:“/var/www/html/DocApp/storage/logs”中没有现有目录,并且它不可构建:权限被拒绝 - Laravel Error: There is no existing directory at "/var/www/html/DocApp/storage/logs" and its not buildable: Permission denied 无法创建目录“/var/www/html/frontend/runtime/cache”:mkdir():权限被拒绝 - Failed to create directory “/var/www/html/frontend/runtime/cache”: mkdir(): Permission denied 将Web应用程序目录粘贴到/ var / www权限错误 - paste web application directory in /var/www permission error 无法提供目录/ var / www / html / public / [Laravel-AWS Elasticbeanstalk] - Cannot serve directory /var/www/html/public/ [Laravel - Aws Elasticbeanstalk] 在/ var / www / html目录中的php中执行python代码 - Execute python code inside php in /var/www/html directory 从/ var / www / pdf /目录将PDF文件嵌入html - Embed PDF file in the html from /var/www/pdf/ directory 在/ var / www / html中编辑 - editing in /var/www/html 通过cronjob执行PHP脚本-脚本中未读取到/ var / www / html /目录中数据目录的路径 - Executing PHP script by cronjob - A path to a data directory in /var/www/html/ directory is not being read in the script 如何授予作曲家在var / www / html中创建文件夹的权限 - How do I give composer permission to create folders in var/www/html move_uploaded_file给出“无法打开流:/ var / www / html中的权限被拒绝” - move_uploaded_file gives “failed to open stream: Permission denied in /var/www/html”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM