ubuntu中的php项目。正确的路径但禁止进入
我正试图在ubuntu 12.04中运行windows7 php项目。我给出了从web控制台看到的正确路径,但没有使用css文件和其他文件。web console显示的错误如下:ubuntu中的php项目。正确的路径但禁止进入,php,.htaccess,ubuntu,apache2,Php,.htaccess,Ubuntu,Apache2,我正试图在ubuntu 12.04中运行windows7 php项目。我给出了从web控制台看到的正确路径,但没有使用css文件和其他文件。web console显示的错误如下: GET http://192.168.1.3/webserver/css/myCSSfile.css [HTTP/1.1 403 Forbidden 0ms] GET http://192.168.1.3/webserver/css/search.css [HTTP/1.1 403 Forbidden 0ms] GET
GET http://192.168.1.3/webserver/css/myCSSfile.css [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/css/search.css [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/css/button.css [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/css/button2.css [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/js/resolutionfinder.js [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/js/changeInputValue.js [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/js/ajaxcalls.js [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/js/ajaxcalls.js [HTTP/1.1 403 Forbidden 0ms]
GET http://192.168.1.3/webserver/images/logo.jpg [HTTP/1.1 403 Forbidden 0ms]
有人告诉我,我必须检查.htaccess文件,以确保我允许访问css、js和images子目录,但实际上我是ubuntu新手,对此我有点困惑。如果有帮助的话,我会使用apache2。谢谢你抽出时间
如果我在终端上编写ps-ef | grep apache,结果是
root 1058 1 0 20:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1067 1058 0 20:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1068 1058 0 20:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1070 1058 0 20:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1072 1058 0 20:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2431 1058 0 20:33 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2432 1058 0 20:33 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2433 1058 0 20:33 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2464 1058 0 20:35 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2465 1058 0 20:35 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2466 1058 0 20:35 ? 00:00:00 /usr/sbin/apache2 -k start
manos 2541 2485 0 20:36 pts/3 00:00:00 grep --color=auto apache
如果我做cd/var/www,然后做ls-la
结果是这样的
total 12
drwxr-xr-x 3 root root 4096 Sep 21 23:16 .
drwxr-xr-x 14 root root 4096 Sep 23 13:04 ..
drwxr-xr-x 8 root root 4096 Sep 23 20:35 webserver
这可能是由错误的文件权限引起的 Apache以什么用户的身份运行? 您可以通过(在终端中)进行检查: 它可能没有读取/写入项目文件的权限。 检查中的文件权限
cd /var/www (or what directory you have)
ls -la
正如Paul所说,根文件夹(/var/www)中的权限与此命令错误,一切正常
sudo chmod -R ugo+rw /var/www
命令说明:
权限的细分如下所示:
u – user
g – group
o – other
“其他”条目是危险的,因为它有效地为每个人提供了文件夹/文件的权限。您可以授予文件或文件夹的权限包括:
r – read
w – write
x – execute
使用-R开关非常重要。如果共享目录中有多个子文件夹和文件,并且希望将权限从父对象(包含文件夹)应用到子对象(子文件夹和文件),则必须使用-R(递归)开关,以便将相同的权限一直应用到最深的文件夹,包含在父级中。我将这些命令的结果放入我的问题中,以防有帮助。谢谢你的时间
r – read
w – write
x – execute