Apache: Invalid command ProxyRequests

ApacheJenkins

Apache Problem Overview


I setup a new Vhost for jenkins:

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName ci.company.com
	ServerAlias ci
	ProxyRequests Off
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
	ProxyPreserveHost on
	ProxyPass / http://localhost:8080/
</VirtualHost>

...which uses proxy and when i restart apache I get error like this:

Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration

Apache Solutions


Solution 1 - Apache

You should enable proxy. Run a command:

 sudo a2enmod proxy
 sudo /etc/init.d/apache2 restart

Solution 2 - Apache

proxy module must be disable. Enable it using below command

a2enmod proxy

If you don't have access to root, you can use

sudo a2enmod proxy

After that restart apache server using

service apache2 reload

Solution 3 - Apache

 sudo a2enmod proxy
 sudo a2enmod proxy_http
 systemctl restart apache2

If you don't enable proxy_http you get this error in the apache error log file for the site:

> AH01144: No protocol handler was valid for the URL / (scheme 'http'). > If you are using a DSO version of mod_proxy, make sure the proxy > submodules are included in the configuration using LoadModule.

This error in general can be found with this message after a new installation with an old vhost:

> Invalid command 'ProxyPreserveHost', perhaps misspelled or defined by a module not included in the server configuration

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTroodoN-MikeView Question on Stackoverflow
Solution 1 - ApacheTroodoN-MikeView Answer on Stackoverflow
Solution 2 - ApacheJitendra PawarView Answer on Stackoverflow
Solution 3 - ApacheLeandro BardelliView Answer on Stackoverflow