3

I am trying to run an Apache server on my Raspberry Pi, as per this tutorial. I currently have a VPN (OpenVPN) running on the same server. Even when I stop the OpenVPN process with sudo service openvpn stop Apache still doesn't work.

I've been trying for the life of me to get an Apache Server work, but whenever I enter its public IP address or the hostname I purchased from DynDNS in my browser, it gets stuck on "Connecting" and never connects. If I am on the same LAN and enter the server's local IP, everything works fine. The strange part is that it appears to be running normally. I increased verbosity of the error logs to info and it has not revealed anything. This is the only entry that stands out.

caught SIGTERM, shutting down
Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u8 configured -- resuming normal operations

which to my knowledge means it should be running fine.

I have the following packages installed

apache2
php5
libapache2-mod-php5
mysql-server
mysql-client
php5-mysql

I have forwarded port 80 on my router to the server. This is particularly confusing because there don't appear to be any errors and I don't have anything to go on. It looks like the requests are simply never reaching the server. Does anybody know why this is, or can you recommend any tools I could use to figure out where the traffic is going?

(note: I am 500 miles away from my server. When I tested if it worked locally, I connected to the VPN and entered the local IP into my browsers address bar.)


access.log

127.0.0.1 - - [20/Apr/2014:08:35:53 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Debian) (internal dummy connection)"

[this entry repeats about 20 times]

error.log

[info] Server built: Feb  8 2014 17:44:20
[info] removed PID file /var/run/apache2.pid (pid=2270)
[notice] caught SIGTERM, shutting down
[notice] Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u8 configured -- resuming normal operations

[again, this repeats about 20 times]

Output of netstat -tlnp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2132/sshd       
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      9152/mysqld 
  • 1
    It seems that requests aren't reaching your server. It's probably working, but traffic isn't getting to it. What happens if you just run Apache without using openVPN? Maybe you're routing traffic to the server's local IP, and Apache's listening on a VPN IP? – Steve Apr 24 '14 at 17:08
  • 1
    Does it work locally. That is if you open the local IP of the Pi on another computer on the same network. Note that port forwarding usually only works if you are outside the network. So you'll have to test if from your neighbors internet connection. – Gerben Apr 24 '14 at 17:59
  • I tried both of these and discovered that when I tried it on the same network with the local IP it worked. See updated question. – qaxf6auux Apr 24 '14 at 21:38
  • what address is your apache configured to listen to? – Gotschi Apr 24 '14 at 22:09
  • 4
    Based on that netstat output Apache doesn't look like it's running at all. Have it bind to *:80 or 0.0.0.0:80. – Fred Apr 26 '14 at 20:16
1

My ISP (Cox) blocks port 80 for webhosting. After some configuration I got Apache to host the site over port 8000 and it worked just fine.

0

Looking at the 'SIGTERM' from the log and assuming you are starting the server by accessing the pi from putty as you are away, looks like after you logout of ssh, terminal gets 'SIGTERM'.

Use

nohup

before your commands.

https://en.wikipedia.org/wiki/Nohup

Or it might be that some other program is trying to kill apache.

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.