Internal Server Error after install 2.3.6 problem apache - 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

Related

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

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.

Apache configuration: how to get quick feedback?

When writing configuration files for Apache web server I would like to have a quick feedback loop.
I, for example have a script that doesn't seem to work. It is either not picked up, or the variables I use are not set, or maybe overriding is not allowed. How to debug this?
I expected to at least print some debug log statements like REQUEST_URI: %{REQUEST_URI}. Can't find such a thing.
apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon.
Here is a link to the documentation.
Different platform might use different binary names such as apache, apache2 or apache2ctl. To test the configuration - just run:
apachectl configtest
# or, depending on your OS
httpd -t
EDIT
If you are trying to debug your virtual host configuration, you may find the Apache -S command line switch useful. That is, type the following command:
httpd -S
This command will dump out a description of how Apache parsed the configuration file

Apache plugin not working for Let's Encrypt

I'm trying to secure my CentOS 7 VPS with Let's Encrypt. I've followed the guidelines in https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-centos-7 . I've set up virtual hosts, installed server dependencies and the Let's Encrypt client. But when I try to set up the SSL certificate with:
./letsencrypt-auto --apache -d example.com -d mail.example.com
I get the error:
The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError()
The Apache Plugin for Let's Encrypt is not working, but how do I make it work?
Same error on CentOS 7 and Apache 2.4. Checked through my configuration, had a couple of IfModule lines that were not closed with /IfModule. Apache is OK with them, but apparently certbot parser isn't. Hope this helps others.
appretnly they are a bug in the letsencrypt-auto script, you can use this command to do the job.
sudo certbot --authenticator standalone --installer apache -d <yourdomain> --pre-hook "systemctl stop apache2" --post-hook "systemctl start apache2"
This answer is not working. In my cases i checked apache config file and found the following line at the end of it <IfModule mod_ssl.c> It was not making sense. On removing it the renewal went on without a problem

How to enable mod_rewrite on Apache server

I need to enable mod_rewrite on a Apache server version 2.4.16. The server is running CENTOS 6.7 x86_64 - I tried many different things but nothing worked.
Also, is there anyway I can find out if mod_rewrite is already enabled?
Thanks,
Richard.
A good way to see if it's enabled is by trying to use it.
The apache documentation shows a pretty simple way to test out mod_rewrite . Place the following in an htaccess file:
Redirect "/foo.html" "/bar.html"
And then check if yoursite.com/foo.html redirects properly.
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
a2ensite is not going to work, that's a binary built into the apache package for debian, you mentioned a centos installation.
To determine specifically if mod_rewrite is built into your apache install, use
httpd -M
To list loaded modules and grep for the one you want (rewrite).
[root#server ~]# /usr/sbin/httpd -M | grep rewrite
rewrite_module (shared)
[root#server ~]#
Test 1:
Easiest way to test if mod_rewrite is ON/OFF is to create a php info file
Under “apache2handler” check for “Loaded Modules” section. There will be a list of loaded modules. Check if mod_rewrite is present in the list.
Test 2:
By creating a file called .htaccess and then by typing the following lines in it
Options +FollowSymLinks
RewriteEngine On
How to find if mod_rewrite is enabled in Apache server?
Try with the command:
sudo a2enmod mod_rewrite

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.