Installing apache as a "manual" service (service that must not start automatically during the boot process) - apache

I am trying to install Apache as a manual service as I don't want it to start automatically during the boot process.
When Apache is installed as a service by httpd -k install -n "apache_2.x", it starts automatically during the boot process which is not required. Like MariaDB/MySQL can be installed as a manual service by mysqld --install-manual "mariadb_10.x", can someone tell me how you install Apache as a manual service?
I also found out that Apache takes an argument called config as httpd -k config which is said to "change startup Options of an Apache service" (as quoted in httpd -h). I speculate that this option can help change the startup behavior. Can someone also please enlighten me on this argument?
Thanks in advance.

Related

Ambari host registration is failing.

I have installed and configured ambari-server as root user and ambari agents as a non root user.
Also
SSH Passwordless authentication is setup and working fine.
ntp is installed and running
Hostname is updated in /etc/hostname /etc/hosts and
/etc/syscongig/network
Anaconda python 2.7.13 is installed as the python environment and
package manager
Restarted the service systemctl restart systemd.hostnamed as well
Add all the sudoer entries as per documentation
At the host configuration page. It is not able to register the hosts
Getting the information message as below and it eventually times out.
BSHostStatusCollector:55 - Request directory /var/run/ambari-server/bootstrap/6
Since I did a non root installation for ambari client. I had to chose the option manual registration instead of automated registration and after that it worked.

Service httpd restart isn't displaying any info

After updating Apache it's no longer printing info on restart:
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
When entering:
service httpd restart
It is completely silent.
When I stop apache I see the following message:
Found 1 leftover httpd processes. Killing.
I'm running Apache/2.4.34 (Unix) on CentOS 6.10. I have updated Apache using Custombuild (DirectAdmin)
Question: Is the leftover httpd process preventing Apache from printing info on restart? How do I fix this?
The showing of messages on service restart is part of the sysvinit scripts. That code in particular is shared among all scripts.
The gist is that the update must have overwritten /etc/init.d/httpd. You can copy an existing script (or recover the httpd one from the distribution's rpm) and fix executable paths or other services that should be running (such as htcacheclean, if it exists in your apache build) based on the one installed by the update.
Now, be aware that systemd is also completely silent when restarting services, although (newer) CentOS init scripts do wrap the call to show messages, if invoked that way.
Also, the rogue left-over process is something you should look at but no, it's not the cause of the messages not printing anymore.

outbound connections (curl, sockets) not working for apache but working as root

After a recent automatic update to linux components (CentOS v7 with PLesk 17.8.11) my web (php) applications are no longer enabled to do outbound connections.
Both "curl" requests and PHPMailer fail; curl is returning http code 0 with no content, while PHPMailer says "SMTP Connect() failed".
The same statements/programs work perfectly when run from terminal (root user). In other words, if I write a trivial program executing "curl http://www.example.com" and run it from terminal, it works; if I call it from a browser, it does not work.
The same is true for any program using PHPMailer to send a mail.
SELinux is disabled, so it does not depends on the httpd_can_network_connect SELinux boolean.
Any idea?
I found a solution, but I did not really understood what the real reason was. By default, my CentOS+Plesk server has SELinux disabled: I changed it to "enabled" with SELINUX=permissive, then I changed two SELinux booleans:
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_sendmail on
Even if SELinux is in warning-only mode, settings those two booleans on made the trick.
Most likely, affected domains are using system PHP, which was updated recently. Correct me if I am wrong.
What would explain broken PHP functionality, because during the update of system PHP package, Apache restart is not triggered by Plesk.
Simply restart Apache in Tools & Settings > Service Management or by using systemctl restart httpd. If the issue still persist after that, try to switch to any of Plesk PHP versions.

Apache restart failed after adding OpenID Connect module

I use Debian 8.0 running an Apache v.2.4.10 and I try to add the OpenID Connect module named libapach2-mod-auth-openidc version 1.6.0.
After installing the module, I enable it with the command: sudo a2enmod auth_openidc. This works fine and now I want to restart the Apache server with sudo service apache2 restart, which leads me to an error
"Job for apache2 failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details."
The result of
systemctl status apache2.service
shows an error while starting the server, but no detailed information of the error (code=exited, status=1/FAILURE).
And the result of
journalctl -xn
tells, that there are no journals.
So if I am disabling the auth_openidc module, the Apache server starts again without problems.
Details of the Configuration:
Apache runs with its default settings. I did not change anything!
auth_openidc module was not changed by me neither at this time!
Can someone explain why Apache with the enabled auth_openidc module would not start anymore?
After installing libapache2-mod-auth-openidc you will have to configure some settings before the module can be used successfully. Two of the mandatory settings are OIDCRedirectURI and OIDCCryptoPassphrase. Most probably you'll also have to configure client credentials for your OpenID Connect provider. You can take a look at the sample configurations at: https://github.com/pingidentity/mod_auth_openidc#openid-connect-sso-with-google-sign-in
Errors/warnings about the missing configuration directives should be displayed in: /var/log/apache2/error.log
While we're at it, I would also advise you to use the latest version 1.8.1 from https://github.com/pingidentity/mod_auth_openidc/releases

errors attempting to start Apache through XAMPP

This is what shows up when I attempt to run Apache without Apache service being activated:
>Status change detected: running
>Status change detected: stopped
>Error: Apache shutdown unexpectedly.
>This may be due to a blocked port, missing dependencies,
>improper privileges, a crash, or a shutdown by another method.
>Check the "/xampp/apache/logs/error.log" file
>and the Windows Event Viewer for more clues
This is what happens when I attempt to install the Apache service:
>Installing service...
>Apache Service detected with wrong path
>Change XAMPP Apache settings or
>Uninstall/disable the other service manually first
>Found Path: ERROR: Not Able To Open Service Manager
>Expected Path: "c:\xampp\apache\bin\httpd.exe" -k run service
>Successful!
...followed by attempting to start Apache after the service (failed) attempt:
>Attempting to start Apache service...
>System Error. Code: 5.
>Access is denied
Does anyone know what's going on here and/or are able to help troubleshoot?
I've already uninstalled and reinstalled with and without (zip file extraction) the installer.
It sounds like something may be running on port 80 already. What happens when you run
netstat -an |find /i "listening"
from the command line?
I had those messages as well. You probably have IIS and XAMPP clashing at port 80. You can either:
disable IIS (if you are not going to run the server regularly).
change XAMPP default ports.
change IIS default ports.
To change XAMPP default ports
Open your XAMPP\apache\conf\httpd.conf file and change the "80" ports to something else, people like "8080".
Open your XAMPP\apache\conf\extra\httpd-ssl.conf file and change the "443" ports to another number.
It should make both services run without conflicts.