简体   繁体   English

禁止使用灯泡服务器403

[英]Lamp Server 403 Forbidden

Hi I just installed ubuntu alongside my Win 7 and I have been using xampp and am very familiar with it, but I just installed lamp and am using the apache2, php, and mysql from terminal and I copied a web folder over from my xampp side and it is saying that I do not have permission to access that file. 嗨,我刚刚在Win 7旁边安装了ubuntu,我一直在使用xampp并非常熟悉它,但是我刚刚安装了lamp,并且从终端使用apache2,php和mysql,我从xampp端复制了一个Web文件夹就是说我无权访问该文件。

I know that on my pc I had some htaccess files but on Ubuntu I am yet to figure out how to view those. 我知道我的电脑上有一些htaccess文件,但是在Ubuntu上,我还没有弄清楚如何查看这些文件。 Is this a product of those .htaccess files or something else? 这是那些.htaccess文件的产物吗?

如果在系统分区上安装WAMP / XAMMP,则会发生这种情况。

so you copied the files form windows to linux? 所以您将文件从Windows复制到Linux? sounds like a classic file permissions problem. 听起来像是经典的文件权限问题。

per default the www folder is in /var/www , so you can simply set the owner of this folder to the apache user which is called www-data , run this in terminal: 默认情况下,www文件夹位于/var/www ,因此您只需将此文件夹的所有者设置为名为www-data的apache用户,即可在终端中运行此文件夹:
sudo chown -R www-data:www-data /var/www

but now you will no longer be able to write to those files yourself, because they are owned by www-data. 但是现在您将不再能够自己写那些文件,因为它们归www-data所有。 checkout this answer for more details and how to get write access: https://askubuntu.com/a/51337 请查看此答案以获取更多详细信息以及如何获得写权限: https : //askubuntu.com/a/51337
or you make it writeable for everyone (which is a bad idea): sudo chmod -R 777 /var/www 或者您使它对所有人都可写(这是一个坏主意): sudo chmod -R 777 /var/www


about editing .htaccess files: 关于编辑.htaccess文件:

I don't use linux with a graphical user interface, but you can edit them with the terminal editor of your choice, on ubuntu you have nano installed by default: 我不使用带有图形用户界面的linux,但是您可以使用所选的终端编辑器对其进行编辑,在ubuntu上,您默认安装了nano
nano /var/www/.htaccess

or if you want a more advanced editor, I suggest vim https://help.ubuntu.com/community/VimHowto 或者,如果您想使用更高级的编辑器,建议使用vim https://help.ubuntu.com/community/VimHowto
vim /var/www/.htaccess

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

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