I'm trying to set up an Amazon EC2 web server on the "Virtual Private Cloud". I'm using this instead of a standard EC2 instance because I needed to assign multiple public IPs and that necessitates the use of VPC.
Anyway, after much hoop jumping, I finally got the instance up and running and connected via SSH. I built the instance from an image I took of a standard webserver that is working fine. However, I don't appear to be able to start Apache:
# service httpd status httpd is stopped # service httpd start Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs [FAILED] # netstat -ltnp 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 1243/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1275/sendmail tcp 0 0 0.0.0.0:9306 0.0.0.0:* LISTEN 1225/searchd tcp 0 0 0.0.0.0:9312 0.0.0.0:* LISTEN 1225/searchd tcp 0 0 :::80 :::* LISTEN 1289/httpd tcp 0 0 :::22 :::* LISTEN 1243/sshd tcp 0 0 :::443 :::* LISTEN 1289/httpd # ps aux | grep httpd root 1287 0.0 0.2 108476 1780 ? S 21:17 0:00 /bin/bash /etc/rc3.d/S85httpd start root 1288 0.0 0.2 11348 1332 ? S 21:17 0:00 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/sbin/httpd root 1289 0.0 1.2 211888 7764 ? S 21:17 0:00 /usr/sbin/httpd
So I'm a bit confused. Apache isn't running (as a service, and I've not set it to run any other ways), and I can't start the service, but isn't this saying that Apache IS running? Any ideas how to resolve?
Apache has been installed and set to start automatically on boot with
chkconfig --levels 235 httpd on, which is why the httpd process is running on boot. However, when you enter
service httpd status it was still reading as stopped and was unavailable through a web browser.
In order to actually restart Apache, it appears that you need to kill the process gracefully (
kill -15 1289 works, where 1289 was the process ID) and then enter
service httpd start. You can now start, stop, restart and reload Apache with no problem.
However, I wanted to be able to use the service command immediately, and further poking around led me to a conclusion that nobody could've realistically provided: One of the SSL keys requires a passphrase, and it couldn't be entered at boot (clearly), so the process was unable to start properly. I removed the passphrase (that we didn't really want, anyway) and rebooted. Now, when I check with
service httpd status I get
httpd dead but subsys locked. I have to delete
/var/lock/subsys/httpd to get the process to start correctly again.
So, it felt like progress, but the process still doesn't start automatically.