Error creating apache certificate - apache

I have a CentOS server and I'm trying to install Apache Certificate using the following command:
certbot --apache -d myDomain.com
But I'm getting the following error:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for myDomain.com
Error while running apachectl graceful.
Job for httpd.service invalid.
Cleaning up challenges
Error while running apachectl graceful.
Job for httpd.service invalid.
Encountered exception during recovery
Error while running apachectl graceful.
Job for httpd.service invalid.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/certbot/error_handler.py", line 100, in _call_registered
self.funcs[-1]()
File "/usr/lib/python2.7/site-packages/certbot/auth_handler.py", line 284, in _cleanup_challenges
self.auth.cleanup(achalls)
File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 1945, in cleanup
self.restart()
File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 1834, in restart
self._reload()
File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 1845, in _reload
raise errors.MisconfigurationError(str(err))
MisconfigurationError: Error while running apachectl graceful.
Job for httpd.service invalid.
Error while running apachectl graceful.
Job for httpd.service invalid.
I check if Apache was running:
ps aux|grep httpd
root 16569 0.0 0.0 9064 920 pts/1 S+ 14:44 0:00 grep --color=auto httpd
I had no instances of apache running.
Any of you knows how can I fix this error or if there is workaround this?
I'll really appreciate your help.

certbot is clearly trying to start/restart apache and that's failing. There could be many reasons for that, and I would start by looking for the apache error log and seeing what it has. (There can be more than one, so check the timestamps.)
It would also be interesting to know if apache can start at all. What happens with a plain old apachectl start?

Related

apache doesn't restart on vagrant

I have a vagrant site setup on my machine as client-machine by vagrantfile (received it from client).
Now on on the machine, I'm unable to restart the apache server. I did the following commands.
sudo service apache2 restart
dpkg-reconfigure -plow apache2
both are giving me following error.
Restarting web server apache2 [fail]
The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/default.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
invoke-rc.d: initscript apache2, action "restart" failed.
Also, when I try to access the error log, it's giving me permission issue.
please help me resolve this issue.
Thanks,
Dilip Gupta

Tomcat not Restarting :: Syntax error on line 106 of /etc/httpd/conf/httpd.conf

When i logged into my remote system (Amazon Linux) after executing apache2 recipe, the httpd service was running, i checked it by using service httpd status, then i wrote service httpd restart after that service stopped but didnt restart. It gives me following error.
[root#java-app1 webapps]# sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Syntax error on line 106 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/mods-enabled/systemd.load: Cannot load /usr/lib64/httpd/modules/mod_systemd.so into server: /usr/lib64/httpd/modules/mod_systemd.so: cannot open shared object file: No such file or directory
[FAILED]

Failed to get D-Bus connection - httpd service in Docker container

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

Apache restart history

Can someone please assist me.
I am trying to find a log on an Ubuntu server that will show me a history of dates and times when Apache was restarted.
Ubuntu version: Ubuntu 10.04.3 LTS
Apache version: 2.2.14 (Ubuntu)
Thanks - Mike
apache usually logs to /var/log/apache2 - depending on what log rotation/cleaning you have going on there should at least be an access_log and an error_log (names may change depending on apache config). In each you should be able to see restart messages.
You could search for configured keyword in apache error logs:
### for centos/redhat:
egrep -irn 'configured' '/var/log/httpd/error_log'
### for ubunto:
egrep -irn 'configured' '/var/log/apache2/error_log'
When we start or restart the apache, we get the logs in /var/log/apache2/error_logs with the word caught SIGTERM, shutting down
So we can find the error_logs with word SIGTERM, will get if apache service start|restart

Can't connect to Apache server on RHEL6

The issue
Now, I am a complete n00b on Apache, and I could certainly use some help with my current issue. I have installed the httpd rpm's on 3 different systems (all Advantech computers, 1 Box PC, 1 Advanced TCA blade, 1 Compact PCI blade, and all have RHEL6 installed). I have configured Apache with files used earlier, on other installations. When I issue the command
# service httpd restart
All goes well and I get this output:
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for <PC_Name>
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
Now, when I try to connect to the machine via Apache, I get the log-in screen asking for the username and password, as you would expect. However, it fails to log-in. When I look at the error_log in /var/log/httpd/, it shows this error message:
[Thu Sep 15 14:24:40 2011] [error] [client 192.168.10.175] (13)Permission denied: Could not open password file: /etc/shadow
[Thu Sep 15 14:24:40 2011] [error] [client 192.168.10.175] PAM: user 'root' - not authenticated: System error
It seems to me that this is either a configuration error, or it has something to do with permissions. Yet I can't seem to find out which. Another interesting fact is, that this only applies to the last two installations(Advanced TCA & Compact PCI), and not the first (Box PC), while all 3 installations are exactly the same.
Additional Info
The way I installed it was install httpd from yum,
# yum install httpd
Next install mod_auth_pam, which is needed by the configuration,
# yum install mod_auth_pam
Then I configured Apache with the files I got from previous installations (which basically is just replacing the configuration files from the standard Apache install), and after that I restarted the Apache service.
For this error "apr_sockaddr_info_get() failed"
You need to properly set your hostname.
hostname actual-non-expired-domain-name.com
Don't forget to set the name in your httpd.conf and in /etc/hosts as well.
I have been able to solve this by setting SELinux to allow Apache requests. This is done by issuing the following command:
semanage permissive -a http_t
Semanage is a utility from the policycoreutils-python package. This should come with the installation medium.