how to remove "Server:Apache" from response header - apache

We have Apache 2.4.34 on a Red Hat Linux Server and I need to remove Server: Apache from the response header.
Is there any easy way to do that without mod_security?
If we need to do it with mod_security only, I have checked the Apache 2.4 documentation and it appears Apache 2.4 wont come with mod_security by default.
Can any one tell me the detailed steps how to install mod_security on Red Hat Linux?
Does mod_security have to be separate from Apache?
How we can configure or make Apache 2.4 to use mod_security?
Do we just need to configure in httpd.conf the same as we load other modules?

Related

How to enable http2 on CentOS7 with Apache 2.4.46

I have CentOS 7, with Apache 2.4.46. I have done pretty much every thing available on internet. I am getting the below error
The mpm module (prefork.c) is not supported by mod_http2. The mpm
determines how things are processed in your server. HTTP/2 has more
demands in this regard and the currently selected mpm will just not
do. This is an advisory warning. Your server will continue to work,
but the HTTP/2 protocol will be inactive.
My apache is running from /usr/local/apache2/.
I have seen, I may need to use php-fpm module to run this.
I have made changes on my live server and It is kinda stuck now. Though work impact is very less but I really want to learn what wrong am I doing
You would need to:
Disable mod_mpm_prefork
Disable mod_php (disable the php module, what ever it's named, example: libphp7)
Enable mod_mpm_event
Enable mod_http2
Enable mod_proxy
Enable mod_proxy_fcgi
Enable mod_setenvif
Install PHP-FPM using yum install php-fpm, or you might need to specify the version yum install php7-fpm or php8-fpm, and then start the PHP-FPM service after installation of that, using systemctl start php-fpm or php7-fpm/php8-fpm.
Add the following to Apache configuration:
<FilesMatch "*\.php">
SetHandler "proxy:fcgi://localhost:9000"
</FilesMatch>
If it is running as an UNIX socket, you would need to change it to:
<FilesMatch "*\.php">
SetHandler "proxy:unix:/path/to/php-fpm.sock|fcgi://localhost:9000"
</FilesMatch>
Restart Apache

Website default to apache page after upgrading to apache from 2.4.17 to 2.4.25

I've upgrade apache2 in order to take advantage of HTTP2.
But now I get the default Apache Ubuntu page when I try to access any of my websites ! - they are configured in separate vhost files in /etc/apache2/sites-available
For example : https://www.pretty-story.com/
Can someone tell me what could be the cause of this ? It's probably a simple configuration change, but I don't where to look at and I'm in panic mode.

I need default configuration for apache 2.4

I don't have default configuration files for apache2.4, because I accidentally replaced the configuration with old apache 2.2, and it's not compatible and make me can't start apache2 server. I've googled around but can't find complete basic apache2.4 configuration.
Thanks

HHVM through Apache mod_fastcgi on debian

I've been able to rather easily get facebooks hhvm working from prebuilt debian packages as well as compile it, and afterwards to run it behind apache as a proxy. The problem with the proxy setup is though, that I can't get response headers other than http status code 200 - like 304 for example - through. It's not the proxy config of apache, but something wrt hhvm and apache interact, or even in hhvm.
Anyway, HHVM officially stopped supporting the standalone server, and they're moving over to fastcgi, and as all of our servers are running Debian, I don't have access to mod_proxy_fastcgi without compiling it (the only backports I found of apache 2.4 don't have mod_proxy_fastcgi backported unfortunately).
So I'm currently trying to get HHVM to run behind the old mod_fastcgi with apache 2.2. But currently I'm only getting "connect() failed" in the error log of apache, while hhvm is listening on :::1080
The important part of my apache config is
RemoveHandler application/x-httpd-php
FastCgiExternalServer /home/www/hhvm/hostname/htdocs/php5.fcgi -flush -host ip6-localhost:1080
AddType application/x-hhtpd-fastphp5 .php
Action application/x-httpd-fastphp5 /php5.fcgi
Alias /php5.fcgi /home/www/hhvm/hostname/htdocs/php5.fcgi
netstat also lists hhvm as listening on :::1080 and I can connect to it via telnet
Any Ideas on what I need to change so it works?
Looks like a IP6 port problem. Try \[ip6-localhost\]:1080 . Not sure if this has side effects in Apache.
How do ports work with IPv6?

mod_proxy with apache tomcat, how do I set it up?

I have my app that serves on localhost:8080. I want to configure things so that it just servers on localhost:80 (or localhost without the port specified). I was told to follow these instructions.
My apache-tomcat that I downloaded is located at /home/myusername/tools/appname/apache-tomcat-6.0.33
I can't find an httpd.conf file in that dir... so I can't make the changes that the above article mentions. I am not sure what to do. I am new to apache/tomcat. Any help would be great!
Those instructions are for apache, which is different from apache's tomcat. What you have (the 6.0.33 thing) is apache's tomcat, which hosts/runs webapps but isn't typically used as a general webserver. You need to download and install apache, then you'll be able to follow those instructions.
You can download the apache webserver here: http://httpd.apache.org/download.cgi
Or if you are using an OS with a package manager, use your OS'es package manager instead.
Typically, the httpd.conf file should be at /etc/apache2/httpd.conf (or /etc/apache/httpd.conf).