0

I have an apache server running, and on this server I have a mongo database running too, listening on standard port 27017.

Is there a way to make a reverse proxy in apache configuration to send requests to my mongo database ?

I tried this, but it doesn't seem to works at all :

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName *********

    # DocumentRoot /var/www/test

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyPreserveHost On
    ProxyPass / http://localhost:27017/
    ProxyPassReverse / http://localhost:27017/
</VirtualHost>
2
  • try to change localhost to 127.0.0.1 ? Commented Oct 26, 2018 at 9:37
  • Hi, it doesn't work neither. Actually, both do exactly the same thing. Commented Oct 28, 2018 at 8:41

1 Answer 1

0

Your requirement needs a TCP proxy and not a HTTP proxy which you are trying to do using Apache. You can use software based like nginx or squid as TCP proxy server or by using pure NAT configuration based on iptables also is possible.

Couple of answers which can help you. TCP proxy mongodb with nginx proxy

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.