99

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
1

3 Answers 3

237

You should enable proxy. Run a command:

 sudo a2enmod proxy
 sudo /etc/init.d/apache2 restart
6
  • If you happen to be using WebMin, you can go into: Servers > Apache Webservers > Global Configuration > Configure Apache Modules. Then in the second column (usually), you will find a module named 'proxy'. Check it on, then scroll to the bottom and hit 'Enable Selected Modules". This will turn on proxy and restart apache at the same time.
    – MindWire
    Aug 20, 2014 at 14:33
  • 13
    While you are at it, enable proxy_http. You need them both to get this working!
    – MindWire
    Aug 20, 2014 at 15:12
  • how to do this in centos ??
    – Harry
    Sep 11, 2014 at 1:27
  • 3
    @TrooddoN-Mike I think it should be sudo a2enmod proxy, anyway +1
    – Tuna
    Jun 27, 2015 at 16:49
  • Im getting this sudo: a2enmod: command not found on mac, do you know how to enable it?
    – ppollono
    Jan 15, 2018 at 11:28
16

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
12
 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.