Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 403样式表错误-Raspberry Pi Web服务器_Css_Linux_Web_Webserver_Raspberry Pi - Fatal编程技术网

Css 403样式表错误-Raspberry Pi Web服务器

Css 403样式表错误-Raspberry Pi Web服务器,css,linux,web,webserver,raspberry-pi,Css,Linux,Web,Webserver,Raspberry Pi,我一直看到我的样式表出现403错误,它托管在我的Rasberry Pi(Web服务器)上。我运行了ls-al,结果如下: pi@raspberrypi ~/www $ ls -al total 16 drwxr-xr-x 2 pi root 4096 Mar 17 20:18 . drwxr-xr-x 12 root root 4096 Mar 15 16:44 .. -rw-r--r-- 1 pi root 644 Mar 17 20:18 index.html -rw-----

我一直看到我的样式表出现403错误,它托管在我的Rasberry Pi(Web服务器)上。我运行了ls-al,结果如下:

pi@raspberrypi ~/www $ ls -al
total 16
drwxr-xr-x  2 pi   root 4096 Mar 17 20:18 .
drwxr-xr-x 12 root root 4096 Mar 15 16:44 ..
-rw-r--r--  1 pi   root  644 Mar 17 20:18 index.html
-rw-------  1 pi   root  329 Mar 17 20:19 stylesheet.css
当我将浏览器指向ip时,index.html数据会显示出来,但没有格式,每当我试图通过查看源代码访问css文件时,它总是告诉我有403错误:(

有人能帮一个兄弟吗


干杯!

您需要对www文件夹拥有适当的权限,这取决于您正在运行的Web服务器。对于debian上的apache,用户是www数据,如果您的webroot是~/www,并且您是用户,请尝试以下命令

  • 递归地将所有者更改为apache用户
  • 将权限更改为以递归方式读取所有

    www-R www-data:www-data/home/pi/www

    chmod-R 644/home/pi/www


您需要更改样式表的权限,目前它设置为用户读/写权限,而不是组权限或世界权限。这就是-rw-----的意思吗?我该如何更改它?嘿,伙计们,如果有人有类似的问题,我会在这里使用sudo chmod 644 stylesheet.css更改样式表的权限来修复它这是我找到的一个快速指南:这里有一个关于正在发生的事情的合理解释:希望这有帮助!