I have a micro instance on AWS that shows that it is running fine on Amazons dashboard
However when i log into the instance with SSH and try to start or stop apache
sudo service httpd stop
sudo service httpd start
I get [FAILED]
sudo apachectl start
doesnt return anything
sudo apachectl restart gives me httpd not running, trying to start
What am i missing? it seems to be doing this out of the blue
is there any command line i can test to see where the issue is coming from?
Have you changed anything in the configuration file?
/etc/init.d/httpd configtest
Is there something else listening on port 80?
fuser -n tcp 80
Related
I have a raspberry pi with apache on it, and I would like to set up SSL on it.
Issues and what I have tried:
When I try to activate the SSL module and run the command: sudo a2enmod ssl and sudo a2enmod default-ssl I get command not found.
My second issue is that I cannot restart the apache webserver, I would run the command sudo /etc/init.d/apache2 restart and as a result I get apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
What am I doing wrong?
Any advice is greatly appreciated.
Thanks in advance
Do you have a default-ssl.conf file in [wherever-it-is]/mods-available/default-ssl.conf
sudo nano it into existence if not,
restarting the server, have you tried "sudo service apache2 restart" or replace "restart" with "reload"?
How do you normally access services on a Pi?
[1] I executed Fabric's sudo('service httpd start').
[chikaram] sudo: service https start
[chikaram] out: Starting httpd: [ OK ]
[2] But my web page is still down!
[3] So I checked httpd status on EC2
[ec2-user ~]$ sudo service httpd status
httpd dead but subsys locked
[4] Then I started httpd on EC2.
[ec2-user ~]$ sudo service httpd start
Starting httpd: [ OK ]
[ec2-user ~]$ sudo service httpd status
httpd (pid 25217) is running...
I've tried this many times but the results always same.
Fabric's sudo('service httpd start') fails with message "httpd dead but subsys locked."
"sudo service httpd status" on EC2 works.
So as of now, I'm doing like: local('ssh chikaram "sudo service httpd start"')
Any ideas?
I faced same problem and resolved by below.
Here is my workaround.
sudo('service %s restart && sleep 5' % service,)
This program restart some service defined above(such as nginx) and wait 5 sec if service restart return code is zero.
I guess root cause is fabric session is shutdown before fork is not completed.
I am creating a Dockerfile for PostgreSQL with CentOS7 as the base image. I am trying to start httpd service with the following command in the container,
service httpd start
and i get the following error:
Redirecting to /bin/systemctl start httpd.service
Failed to get D-Bus connection: No connection to service manager.
The log file directory /var/log/httpd is also empty. I guess this is the problem with Docker CentOS7 image. Any help appreciated.
I have run into this a well.
It might not be the best way, but you can find a copy of the /etc/init.d/httpd file from another computer. copy that into the container in /etc/init.d
then run
chkconfig --level 345 httpd on
then you will be able to use either
/etc/init.d/httpd start or service httpd start
I have installed Apache on my Ubuntu Server.
For a special reason I have to enable mod_rewrite on it.
So I have done this.
And in every Tutorial on the internet the last command is to restart apache.
But when I do this the console prints [fail].
Can anyone help me here?
$ service apache2 restart
* Restarting web server apache2 [fail]
I had a similar problem, and for me it was about the logged in user not having privileges so instead of
service apache2 restart
I had to do
sudo service apache2 restart
It's telling you some other service is already on port 80, perhaps it's apache
try Code:
sudo /etc/init.d/apache2 stop
followed by Code:
sudo killall apache2
then make sure no services are running on port 80 Code:
sudo netstat -l|grep www
then (re)start apache Code:
sudo /etc/init.d/apache2 restart
Using the systemd features ( starting from Ubuntu 15) , you can restart apache service as follow :
sudo systemctl restart apache2.service
Check the status:
sudo systemctl status apache2.service
There are various reason for this one .
could be the privilege problem if you have privilege problem then
please use sudo for the same .
could be the apache already running in your system then please check the
status of the service by running command service apache2 status if they
said that [FAIL] apache2 is not running ... failed! it mean it is not running
you can start by the command service apache2 start or sudo service
apache2 start
if you having not above problem please look at the PID file of
apache2 by following command cat /var/run/apache2/apache2.pid
which will give you the process ID of the apache it means you
system accidentally shutdown without deleting the PID file so
delete by following command rm - rf/var/run/apache2/apache2.pid or sudo rm -rf/var/run/apache2/apache2.pid and start again the server by
following command service apache2 start or sudo service
apache2 start
I face this issue when I was adding new web site to my web server which is hosted in Digital Ocean Cloud service. So what happened was, when I using sudo commands to restart or reload apache2 server its restring with following error messages.
For me everything worked well despite these two error messages.
Error 1 - Unable to resolve host 'YOUR HOST NAME' .
Error 2 - sum_functio_error() //I don't remember this function name I'll update this later.
So the fix was very simple.
First open your hotsts file.
sudo nano /etc/hosts
Output File
127.0.1.1 hostname
127.0.0.1 localhost
sudo nano /etc/hostname
Output File
hostnamexxx
Try below command to restart.
# /etc/init.d/apache2 restart
OR
$ sudo /etc/init.d/apache2 restart
OR
$ sudo service apache2 restart
To stop Apache 2 web server, enter:
# /etc/init.d/apache2 stop
OR
$ sudo /etc/init.d/apache2 stop
OR
$ sudo service apache2 stop
To start Apache 2 web server, enter:
# /etc/init.d/apache2 start
OR
$ sudo /etc/init.d/apache2 start
OR
$ sudo service apache2 start
Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled.
I have Ubuntu 11.10
When I run the command to start apache2:
sudo /etc/init.d/apache2 start
I get the following error message:
Starting web server apache2
apache2: Could not reliably determine the server's fully qualified
domain name, using 127.0.1.1 for ServerName (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 Action 'start'
failed.
I run this command in order to get the process that is using the port 80:
sudo netstat -ltnp | grep ':80'
Which returns this output:
tcp6 0 0 :::80 :::* LISTEN 1176/
To know which process is I run this command:
ps -wlp1176
That returns:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
5 D 33 1176 1 0 80 0 - 0 exit ? 00:00:00 apache2
But if I try to kill the process:
sudo kill -9 1176
It doesn't kill it, if I run again the netstat command still appears listening and apache start fails.
Any suggestions?
Worked for me running this command:
fuser -k -n tcp 80
It may be skype or nginx using the port 80.
Try shutting down skype, or running: sudo /etc/init.d/nginx stop
I had the same error, and just want to confirm that running
sudo netstat -ltnp | grep ':80'
helped me indicate that Hiawatha webserver was in the way of Apache2.
Removing Hiawatha fixed the issue (sudo dpkg --purge hiawatha).
Ubuntu 12.04.2 server.
I had the same problem
For me, apache was already running but it was running the wrong way.
Killing processes didnt work because a daemon kept reinstantiating it.
apachectl stop
resolved the issue.
use either
sudo killall httpd
or
sudo killall apache2
check if some one using the 80 port
sudo netstat -tulpn| grep :80
The restart
sudo service httpd start
then restart the server.It took me a whole day to understand the issue
Try this, it works for me…
sudo netstat -ltnp | grep ':80'
This would return the following:
tcp6 0 0 :::80 :::* LISTEN 1047/apache2
Then
sudo kill -9 1047
Then I was able to restart Apache and everything was working fine.
Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).
Reboot and enjoy!
This will happen because of repeated installation of apache or port is using by another service
sudo lsof -i | grep "httpd"
You will find process id and listening port of service. Then check
cd /proc/(process id of http)
Then kill that process using command
kill -9 pid
now
sudo netstat -nltp
again kill the process
syntax:-
kill -9 pid
and now start apache
sudo ./apachectl start
It look like other process is using port 80.
$ netstat -anp | grep
eg. $ netstat -anp | grep 80
by above you get process name, if you want to use port then you need to stop the process or change the port
What I would do is simply check if the following is set in your /etc/apache2/sites-available/your-domain-name.com.conf
SSLEngine on
SSLCertificateFile /your/path/to/your-domain.com.crt
SSLCertificateKeyFile /your/path/to/your-domain.com.key
SSLCACertificateFile /your/path/to/your-domain.com.ca-bundle
and there aren't any mistyped directories or anything else that would not supposed to be in your .conf file. It did the trick for me as re-starting and killing the processes did not help at all. It did not start anyway.
I fixed it by using below procedure.
Run below command as root user.
root# ps aux |grep apache
It will show you Apache PID, just kill that PIDs and restart Apache Server.
You can only have listen PORTNUMBER in only one file of .conf. Do not put it in multiple files. Try it :)