1

I'm trying to enable a service on my home server that has a different document root than my main site. I can't figure out how to edit the site .conf files so that I can run both the main site and the new service.

My use case: I've got a home server running Ubuntu 16.04.1 and Apache 2. I can browse to my site at ceres.local. I also installed OpenProject 6.1. After the install completes, I can browse to that service at ceres.local/openproject, but now browsing to ceres.local returns a 403 Forbidden.

I checked my sites-enabled, and I see that the 000-default.conf is no longer listed, just openproject.conf. So, I ran a2ensite 000-default.conf and service apache2 reload. Now, I can browse to ceres.local, but ceres.local/openproject returns a 404 Not Found.

How do I get both 'ceres.local' and 'ceres.local/openproject' to serve properly with the two .conf files below? Note the different document roots.

My 000-default.conf reads as follows:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ServerName ceres.local

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

And my openproject.conf reads as follows:

Include /etc/openproject/addons/apache2/includes/server/*.conf

<VirtualHost *:80>
      ServerName ceres.local
      DocumentRoot /opt/openproject/public

      ProxyRequests off

      Include /etc/openproject/addons/apache2/includes/vhost/*.conf

      ProxyPass /openproject/ http://127.0.0.1:6000/openproject/ retry=0
      ProxyPassReverse /openproject/ http://127.0.0.1:6000/openproject/

</VirtualHost>
the_meter413
  • 231
  • 3
  • 19

1 Answers1

0

I know is a very old post. But I spend 3 days to solve this and is a first post when we google so, when you install openproject he create a file called openproject.conf and disable the 000-default.conf

inside this file are a configuration like this

    Include /etc/openproject/addons/apache2/includes/server/*.conf
   <VirtualHost *:80>
     ServerName mydomain.com
     DocumentRoot /opt/openproject/public

     ProxyRequests off

     Include /etc/openproject/addons/apache2/includes/vhost/*.conf
     # Can't use Location block since it would overshadow all the other 
     #Proxypass directives on CentOS

    ProxyPass /help/ http://127.0.0.1:6000/help/ retry=0
    ProxyPassReverse /help/ http://127.0.0.1:6000/help/
</VirtualHost>

but when you try acess the mydomain.com you receive the message 403 - forbitten you just need modify the file like this

    Include /etc/openproject/addons/apache2/includes/server/*.conf
<VirtualHost *:80>
  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot /var/www/html  # <----- LOCATION WHERE YOU SITE ARE
  #DocumentRoot /opt/openproject/public #<--- You Need comment this line

  ProxyRequests off

Include /etc/openproject/addons/apache2/includes/vhost/*.conf

# Can't use Location block since it would overshadow all the other proxypass 
directives on CentOS
ProxyPass /help/ http://127.0.0.1:6000/help/ retry=0
ProxyPassReverse /help/ http://127.0.0.1:6000/help/

So, if can see the proxypass below, apache will redirect to then when you put mydomain.com/help (you be redirect to openproject), mydomain.com (you main site )

I Hope with this help someone Be Happy :)

Cloudcon
  • 21
  • 7