-2

I have apache on linux with owncloud on it and I want to access it with owncloud.domain and not domain/owncloud. For example from apache.local/owncloud to owncloud.apache.local I have apache with IP 192.168.0.103 and proxy with 192.168.0.106. This is my proxy's config

<VirtualHost *:80>
    ServerName http://apache.hcentos.local/
    ServerAlias apache.hcentos.local
    ProxyRequests Off

    #drupal
    ProxyPass /drupal http://192.168.0.103:80/drupal
    ProxyPassReverse /drupal http://192.168.0.103:80/drupal

    #owncloud
    ProxyPass /owncloud http://apache.hcentos.local:80/owncloud
    ProxyPassReverse /owncloud http://apache.hcentos.local:80/owncloud
</VirtualHost>       

I want to write owncloud.apache.hcentos.local and get to owncloud. Same for drupal. Please help.

closed as off-topic by Esa Jokinen, Ward, Jenny D, Stefan Lasiewski, kubanczyk Mar 29 '18 at 15:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please expand your question to include more relevant information. What is the configuration you currently have? Post your sites configuration so we can see what is setup and provide information on how to change it. – Andrew Mar 22 '18 at 15:44
  • I think you can add a VirtualHost directive for the owncloud.domain.com ServerName and then use ProxyPass there. – Andrew Mar 22 '18 at 15:59
  • I understood I must have two virtual hosts, bud don't know how to configure the thing I am asking – Hristo Mar 22 '18 at 16:04
1

You should be putting the required configuration inside of a VirtualHost directive where the ServerName directive is configured with the desired hostname: owncloud.domain.

Drupal should also be in it's own VirtualHost as well.

Within each of these, configure your ProxyPass directive to point to the right server/path. You should also add ProxyPassReverse.

All of this is documented with examples in Apache's docs:

Apache docs with examples for Revers Proxying: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Apache docs for VirtualHosts: https://httpd.apache.org/docs/2.4/vhosts/

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