ERR_EMPTY_RESPONSE when active mpm_event - apache

I try to activate mpm_eventon my Apache (OS Debian 9 ) and disable mpm_prefork for active http/2 on my site.
But When I do that, my site goes down and shows ERR_EMPTY_RESPONSE on the browser.
The following commands I used to do that:
sudo apt-get install php7.4-fpm
sudo a2enmod proxy_fcgi
sudo a2dismod php7.4
sudo a2enconf php7.4-fpm
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo service apache2 restart
In the apache log I see just this error:
AH00052: child pid 27520 exit signal Aborted (6)
Is there anyone who knows what should I do to fix that?

I found out that the problem is because of Mod_Ruid2 conflicts with PHP_fpm.
When I disabled Mod_Ruid2 the site was back up and running without any problems.
a2dismod ruid2
The purpose of mod_ruid2 is to allow run of scripts with the users
permission when Apache is using mod_php. In that mode Apache is ran
with root and child processes are being setuid-ed to the proper user
so they can't touch other user files.
The php-fpm is completely different approach. With php-fpm the apache
does not compile php scripts - everything is done by external binary
(called php-fpm). Therefore there is absolutely no need for mod_ruid2
when you are using php-fpm.
https://forum.directadmin.com/threads/php-fpm-and-mod_ruid2-with-php7-1.56552/
https://forum.vestacp.com/viewtopic.php?t=16041

Related

Wondering - "sudo ufw app list" still show apache after removal

I thought i had completly remove Apache from my server, until this morning where i could see, this sudo ufw app list
ALlready many posts here on how to remove apache etc... and everything works fine.
I'm just wondering why Apache still shown here ?
sudo ufw app list lists every app profile that you've made on the firewall. Although you uninstalled apache its profile on the firewall still exists.
If you'd like to remove it try
sudo rm -R /etc/ufw/applications.d/apache2*

Apache not starting alongside Nginx

Have a development server with 2 static ips. Apache runs on one, Nginx on the other. Everything seems fine except after reboot. Nginx starts Apache doesn't. Can someone please tell me where to look outside log files for what the issue could be...or tell me the process on how to make this work..
Thanks in advance...
12/19/2018
Rebuilt the server using only Apache. When binding it to a single ip to one interface it still does not start after boot. When I unbind it, it boots fine. Doesn't seem to be a conflict with Nginx on the other ip, seems to do with the binding of Apache itself...still perplexed...
I went to sudo nano /etc/apache2/ports.conf
Changed Listen 80 to Listen 8080 and I was able to restart apache2 after that with the following command:
sudo systemctl restart apache2
It's probably because default port for both nginx and apache is 80. So for example when nginx starts, the port will be in use, and apache can't access to that port.
in ypur httpd.conf of apache, find the line that says Listen 80 and change that port to whatever you want. then restart apache.
If this is not the issue, then report results of these commands in your post plz:
$ systemctl status httpd // or apache2 instead of httpd
$ systemctl status nginx
$ jourcanctl -xe

How can "localhost" give an answer when apache2 is not installed?

My apache2 configuration is driving me crazy, and since I'm new to Linux/Ubuntu (16.04) and servers, I've been trying to install/remove lamp (and also xampp, and also phpmyadmin) a great number of times now, with several methods... without much results.
However, my current configuration is :
mysql-server is installed, and I can connect with 'mysql -u root -p'
phpmyadmin : I have tried to reinstall it, but there was a problem with apache2 (could not reload it or something... I haven't figured it yet)
php7 is installed and has been working until my server has crashed (I haven't tried to remove it)
apache2 : I used to have a lamp configuration + XAMPP (lampp in /opt/), but since there has been a problem, I uninstalled XAMPP and recently I also unistalled apache2 (sudo apt-get purge apache2, sudo apt-get autoremove, sudo apt-get clean and I verified that the configuration files have been deleted).
When I still had apache2, I finally had this problem : when opening "localhost" on Firefox, it was showing :
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /
on this server.<br>
</p>
<p>Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
My main question for this post now :
Since I have deleted Apache2, "localhost" should not be working at all now on my browser (Firefox)... However, I still get the exact same page ?! Do you know why / can help me ?
Thanks a lot in advance to all who can help me, either to understand my problem better (so that I know a bit more where/how to search for answers), or to solve my problem (and help me work on my website again ^^) !
Have you already stopped Apache via systemctl? Something like sudo service stop apache2 (or is it sudo service apache2 stop), will stop the server from running. Even though you have uninstalled everything, the server process will still run if you haven't stopped it.

Why I can't reload apache2 on Ubuntu?

On Ubuntu, each time I use sudo service apache2 reload command to reload apache2 service , my terminal showed
apache2.service is not active, cannot reload.
And, I'm trying to add phpMyAdmin as virtual host, using phpmyadmin.local as local-area-network domain name; can anyone tell me how? I have tried many times today, I searched many methods, but until now, it's still 404 not found.
I had the same problem with Ubuntu 16.04. This was causing problems with logrotate, because it could not reload Apache after rotating logs.
The full error I was getting:
/etc/init.d/apache2 reload
[....] Reloading apache2 configuration (via systemctl): apache2.serviceapache2.service is not active, cannot reload.
failed!
The problem went away after stopping Apache with apachectl and starting it with /etc/init.d/apache2:
apachectl stop
/etc/init.d/apache2 start
You can now reload Apache:
/etc/init.d/apache2 reload
[ ok ] Reloading apache2 configuration (via systemctl): apache2.service.
If you start Apache with apachectl start, it is not being marked as an active service, so you can't reload it with service apache2 reload. You have to start Apache with /etc/init.d/apache2 start or service apache2 start.
I'm not sure if it's intended or a bug. I can't reproduce this with an older system.
Actually you should check if another service/server is running in the port 80 :
sudo netstat -tulpn | grep :80
If it's not apache2, stop it (for me it was lighttpd so sudo service lighttpd stop.
Then start apache2 (sudo service apache2 start) and enjoy!
check if you are missing /usr/sbin/apache2
Then if you are run: sudo apt install --reinstall apache2-bin

Unable to find httpd directory in Amazon EC2 to configure PhpMyAdmin

I am new to amazon servers. I have Installed PhpMyadmin in my Amazon EC2 server. To access my server's PhpMyadmin from my PC it seems I need to configure some files. According to this link I need to change the file /etc/httpd/conf.d/phpMyAdmin.conf But there's no directory or file named 'httpd' in /etc directory. Where can I find the httpd directory? How can I configure my machine to access phpmyadmin? I almost tried every solution in stackoverflow and none of them worked for me. Any help is appreciable.
First you need to configure web-server on your ec2 instance. You can install apache as a webserver.
For RHEL/Amazon/Fedora Distro issue following commands:-
sudo yum install httpd
Then make changes in /etc/httpd/conf.d/phpMyAdmin.conf according to the Link you are using and restart the apache web server.
sudo service httpd restart
You can access PHPMyAdmin by http://ec2-ip-address/phpmyadmin
For Ubuntu/Debian Distro issue following commands:-
sudo apt-get install apache2
Then make changes in /etc/apache2/conf-enabled/phpmyadmin.conf according to the Link you are using and restart the apache web server.
sudo service apache2 restart
You can access PHPMyAdmin by http://ec2-ip-address/phpmyadmin