简体   繁体   English

ubuntu14.04上的apache2禁止访问

[英]Access forbidden on apache2 on ubuntu14.04

I have installed apache2 server on Ubuntu 14.04. 我已经在Ubuntu 14.04上安装了apache2服务器。 It is working well with the files and directories which i have created here after installation, but if i copy any file or folder from anywhere else (already written) then is gives Forbidden error message. 它与我在安装后在此处创建的文件和目录配合使用时很好,但是如果我从其他任何地方(已写过)复制任何文件或文件夹,则会出现Forbidden错误消息。 Thanks in advance. 提前致谢。

For a file to be accessible by apache2, it should be owned by the user which runs the apache2 server. 为了使apache2可以访问该文件,该文件应由运行apache2服务器的用户拥有。 On most systems the user is www-data or httpd or apache. 在大多数系统上,用户是www-data或httpd或apache。 To find which user is that, just look into your apache2.conf or httpd.conf. 要查找哪个用户,只需查看您的apache2.conf或httpd.conf。 Once you know the user, make it the owner of the copied files/folders or reiterate it for the whole /var/www//html folder. 认识用户后,使其成为已复制文件/文件夹的所有者,或针对整个/ var / www // html文件夹重申该用户。

sudo chown -R www-data:www-data /var/www/html

This should do it. 这应该做。 But, if it doesn't, verify that the user has at least read and execute permissions on the folder (write also, if you need to write some data through your script). 但是,如果没有,请验证用户是否至少具有对该文件夹的读取和执行权限(如果需要通过脚本写入一些数据,也要写入)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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