0

I used this guide to set up Apache2 and PHP5: link.

I set up a simple PHP script, debugged some permissions issues, got everything working. A few hours later, it stopped working. I could no longer access my script over the web.

When I open a browser on my PC and point to the server's IP address (I am not using a domain, this server is just for serving one PHP script), the connection times out. I followed several steps from this guide: link.

Here's what I've tried so far:

  • Confirmed that apache is running
  • Confifmed that port 80 is open
  • Confirmed that html/php pages are at the proper directory

Other than installing Ubuntu, Apache, and PHP, all I have done is change a few permissions. So, since I'm new to Ubuntu, I assume that's where the problem must be. Here's how the permissions are set in my html directory:

$ 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
$ 

Note I'm not using index.html - I just go directly to my script - so I'm assuming it doesn't matter what permissions are set for index.html.

I also checked my apache error log, and these are the last few entries from AFTER the last time I could connect:

[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'

Does anything here stand out? What are some other trouble-shooting steps I can take?

0

Turns out it was a firewall issue. I needed to change from this:

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

To this:

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

Not sure why it worked for a while at first. The person in my lab who ended up helping me with this speculates that the server may have loaded some default configuration during some upgrade/reboot process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.