Invalid command 'RemoteIPProxyProtocol' (httpd 2.4.6) when running httpd behind HAproxy in tcp mode - apache

I'm trying to setup PROXY protocol between a HAproxy acting as a load-balancer (tcp mode) and httpd (2.4.6)running behind. The objective is to get the "real" client IP addresses on the httpd-side.
In haproxy.conf the keyword send-proxy has been put in the selected backend.
The line:
LoadModule remoteip_module modules/mod_remoteip.so
has been added to httpd config file.
The directive RemoteIPProtocolAddress On has been set in the httpd virtualhost configuration file.
However, when reloading/restarting httpd the following errors appears:
[root#XXXXXXXXX conf.d]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: enabled)
Active: failed
[...]
Invalid command 'RemoteIPProxyProtocol', perhaps misspelled ...
Looking at the mod_remoteip source code for httpd 2.4.6, it appears the directive RemoteIPProxyProtocol does not exist anymore.
I'm not sure to understand how the versioning works. For instance I can see the RemoteIPProxyProtocol directive exists in mod_remoteip 2.4.43 but not in mod_remoteip 2.4.0.
How can I workaround this issue ? E.g. compiling another mod_remoteip version ? Downgrading httpd? Other?
Thanks.

Happened to meet the same problem, and after checking the documentation:
RemoteIPProxyProtocol is only available in httpd 2.4.31 and newer
I'm currently running Apache/2.4.29 on Ubuntu 18.04 and Apache/2.4.41 on Ubuntu 20.04, it works with 2.4.41.

Related

Internal Server Error after install 2.3.6 problem apache

I need help with the installation of Magento 2.3.6 this is returning an error in apache:
core: alert] [pid 23385] [client 179.232.122.240:2423] .htaccess: Invalid comid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
I already wasted a lot of time researching and tested a lot, but nothing worked, could someone help me?
Invalid comid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
This implies you don't have mod_env installed in Apache. You need to install/enable this module and restart Apache.
This is a little unusual since mod_env is considered a "Base" module and is "compiled and loaded into the server by default".
Reference:
https://httpd.apache.org/docs/2.4/mod/mod_env.html
To find out which Apache modules are enabled, check #ValentinBajrami's answer to the following question on ServerFault:
To list apache loaded modules use:
apachectl -M
or:
apachectl -t -D DUMP_MODULES
or on RHEL,CentoS, Fedora:
httpd -M
And the following question if you need to install/enabled mod_env:
How to enable mod_env in Apache

Amazon Lightsail: Bitnami LAMP server website hosting: sudo service apache2 restart

I am trying follow the guide here:
http://www.servermom.org/how-to-add-new-site-into-your-apache-based-ubuntu-server/
to host a few PHP files on the web. Everything works until the second to last step: the command in the title. The console message I get is below:
bitnami#ip-*not important*:~$ sudo service apache2 restart
* Restarting web server apache2
AH00112: Warning: DocumentRoot [/var/www/html] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified do
main name, using 127.0.0.1. Set the 'ServerName' directive globally to suppres
s this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]
:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.
0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
[fail]
* The apache2 instance did not start within 20 seconds. Please read the log f
iles to discover problems
I open the access.log and error.log files in /var/log/apache2 with nano and both appear empty. Any ideas on why "Action 'start' failed"?
Thanks in advance for any help
Bitnami puts the systems under it's control into a non-standard location. They can be found under /opt/bitnami. I'd recommend checking out their Documenation on the configuration of Apache.
Common differences:
Configuration is stored in /opt/bitnami/apps/myapp/conf/
Base folders like /var/www are application specific like /opt/bitnami/apps/<app_name>/htdocs/, where is the name of your app.
Restarting Apache can be done with sudo /opt/bitnami/ctlscript.sh restart apache
Access and Error logs can be found at /opt/bitnami/apache2/logs/access_log and /opt/bitnami/apache2/logs/error_log respectively
Hope that helps get you in the right direction.

Not able to start Apache HTTP Server on Cent OS 6.4

While starting Apache tomcat, am getting error Starting httpd: Syntax error on line 3 of /etc/httpd/conf/httpd.conf: Invalid command 'AddHandler', perhaps misspelled or defined by a module not included in the server configuration I am using Cent OS 6.4 . I used the command service httpd start for starting the server.
You are trying to use Apache HTTP server configuration file with Tomcat.
Tomcat has it's own config files in TOMCAT-HOME/conf/ directory.
If you're actually talking about Apache HTTP, not Tomcat, you may get this error if there's no mime_module. Run httpd -M command to check if mime_module present or not.

Starting web server apache2 failed

I have a Virtual Server. Till yesterday everything works fine on it.
Today my Hostcompany restarted my server to config something on I/O.
When I trying to get to my address I get
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
I tried to sudo service apache2 start and get these Error Message:
* Starting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
*
* The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Does someone know how I can fix this problem?
Stop Nginx service nginx stop
Restart Apache service apache2 restart
You have another webserver that's running on the host (probably as part of the startup during the restart) You need to shut that off first.
You can run netstat -tulpn | grep :80 and that'll tell you what that process is
The problem is this, Nginx (another web server engine) it's using your port 80 so apache it's unable to start, a fast fix it turn of nginx and then restart apache.
You can do it with service nginx stop and service apache2 restart if you are using Ubuntu or Debian based release, if you are using an RHEL distro then use service nginx stop and service httpd restart
Here is my solution
first: sudo update-rc.d -f nginx remove
than: sudo rm /etc/init.d/nginx
after restarting VM almost everything works fine. Some strange thing is almost there.
When I goto www.myfoobarwebpage.com now apache is working and it's all ok!
When I goto myfoobarwebpage.com (without www.) I get "Welcome to nginx! ..."
Try this. My Apache config has 2 extra lines by mistake.
"Include conf/extra/httpd-8080.conf"
"Include conf/extra/httpd-8080.conf"
Therefore, it was saying address already in use because it already loaded the Virtual host once and was trying again.
Solution was to delete this extra line and have only one include.

Apache SSL server not starting, "Address already in use"?

I have installed Apache 2.0.58 together with PHP 5.1.4. When I start the server using ./apachectl start, I manage to get the server running to serve HTTP as well as PHP pages, but when I try to start SSL for HTTPS using ./apachectl startssl, I get the error below:
(125)Address already in use: make_sock: could not bind to address [::]:54912
no listening sockets available, shutting down
Unable to open logs
When I run netstat -an | grep 54912 I don't see that port 54912 is being used at all. For reference, I hosted my HTTPS page on port 54912, and while in "httpd.conf" it already has the Listen 54912 directive, I also changed the file "ssl.conf" to Listen 54912 from the default Listen 443for https.
Any idea how I can get my server to run and serve HTTPS?
It's probably because apachectl startssl was deprecated in version 2.0 (and was removed in has version 2.2)
It's likely that apache start has already started the SSL virtual hosts, in particular if these virtual hosts (or other SSL-related options) haven't been defined in a <IfDefine SSL> section (because in Apache 2.0, apachectl startssl is equivalent to apachectl -k start -DSSL): they would be part of the main configuration.
Got the server running! :)
As mentioned by #EJP, the problem is because there are 2 Listen 54912 inside config. So by changing the file httpd.conf to Listen 14912 and retaining the file ssl.conf to Listen 54912, I can now run apachectl startssl and after entering the password, the server is up and running!
Special thanks to Tim Yencken for the help. (Dunno if he's here or not).