我使用本指南设置Apache2和PHP5:link。
我设置了一个简单的PHP脚本,调试了一些权限问题,让一切正常。几个小时后,它停止了工作。我无法再通过网络访问我的脚本了。
当我在PC上打开浏览器并指向服务器的IP地址(我没有使用域,此服务器仅用于提供一个PHP脚本)时,连接超时。我按照本指南的几个步骤进行了操作:link。
这是我迄今为止所做的尝试:
除了安装Ubuntu,Apache和PHP之外,我所做的只是更改一些权限。所以,既然我对Ubuntu很新,我认为问题必定存在。以下是我在html目录中设置权限的方式:
$ pwd
/var/www/html
$ cd /var/www
$ ls -l
total 4
drwxr-xr-x 2 root root 4096 May 3 12:07 html
$ cd html
$ ls -l
total 20
-rw-r-Sr-- 1 www-data root 379 May 3 12:30 dataentry.php
-rw-r--r-- 1 www-data www-data 1383 May 3 13:03 datalog.csv
-rw-r--r-- 1 root root 11510 May 3 10:40 index.html
$
请注意,我没有使用index.html - 我只是直接转到我的脚本 - 所以我假设为index.html设置的权限并不重要。
我还检查了我的apache错误日志,这些是我上次连接后的最后几个条目:
[Tue May 03 13:20:33.630151 2016] [mpm_prefork:notice] [pid 16374] AH00169: caught SIGTERM, shutting down
[Tue May 03 13:20:34.710242 2016] [mpm_prefork:notice] [pid 17929] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal oper$
[Tue May 03 13:20:34.710284 2016] [core:notice] [pid 17929] AH00094: Command line: '/usr/sbin/apache2'
[Thu May 05 14:59:03.584613 2016] [mpm_prefork:notice] [pid 17929] AH00169: caught SIGTERM, shutting down
[Thu May 05 14:59:04.664584 2016] [mpm_prefork:notice] [pid 26724] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.16 configured -- resuming normal oper$
[Thu May 05 14:59:04.664628 2016] [core:notice] [pid 26724] AH00094: Command line: '/usr/sbin/apache2'
这里有什么突出的吗?我可以采取哪些其他解决问题的步骤?
披露:我最初是在服务器故障上发布的,但几天后没有得到回复。
答案 0 :(得分:0)
$ ls -l 总共4 drwxr-xr-x 2 root root 4096 5月3日12:07 html
应该是它,你拥有root所拥有的/ var / www / html目录。试试这个: chown -R www-data:www-data / var / www
答案 1 :(得分:0)
原来这是一个防火墙问题。我需要改变这一点:
Chain ufw-user-input (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * X.X.X.X 0.0.0.0/0
4473 250K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:22
对此:
Chain ufw-user-input (1 references)
pkts bytes target prot opt in out source destination
1 52 ACCEPT all -- * * X.X.X.X 0.0.0.0/0
2 112 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:22
9 420 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:80
不知道为什么它起初有效。我实验室中最终帮助我的人推测服务器可能在某些升级/重启过程中加载了一些默认配置。