0

I have one big server (temporary and some websites will be moved to several others at some point) where I installed all the tools I need for my project (Jira, Bamboo, etc.) and now I need to add one 'regular' website to the mix that instead of all the other websites already configured don't really need to be proxied by apache and can be served directly.

So to make it a bit more clear, I have Jira, bamboo and some other applications running on their standalone Tomcat for which apache is proxying the requests and I want to add a regular website to this configuration but when I add my vhost configuration all the websites go down.

Here are my configuration files :

apache2.conf :

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

Sample config file for application behind tomcat standalone (There is 4 like that):

<VirtualHost *>
    ServerName jira.example.com

    # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts)
    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://example.com:8080/
    ProxyPassReverse / http://example.com:8080/

    <Location />
        Order allow,deny
        Allow from all
    </Location>

    LogLevel info

    ErrorLog ${APACHE_LOG_DIR}/jira_error.log
    CustomLog ${APACHE_LOG_DIR}/jira_access.log combined

</VirtualHost>

Config file for the new vHost (work in progress):

<VirtualHost *:80>
    ServerAdmin myemail@example.com
    ServerName testing.example.com
    DocumentRoot /var/atlassian/application-data/bamboo/xml-data/build-dir/DFWA-DFWAAT2-DEV

    CustomLog /var/log/apache2/testing/access.log combined
    ErrorLog /var/log/apache2/testing/error.log

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://testing.exemple.com/
    ProxyPassReverse / http://testing.exemple.com/

    <Location />
        Order allow,deny
        Allow from all
        require all granted
    </Location>
</VirtualHost>

I also have a config file for phpmyadmin that I don't think is required to troubleshoot our problem here.

I changed several times the file for the new vhost wich resulted in different behavior :

I started with a small config file with not much in it (serveradmin, servername, documentroot and log config) but when I add the file no websites are available anymore with a 403 Forbidden error and nothing in error.log or access.log

I tried to add a directory directive like this :

<Directory "/var/atlassian/application-data/bamboo/xml-data/build-dir/DFWA-DFWAAT2-DEV">
    Options FollowSymLinks
    Require all granted
</Directory>

With this the new site is reachable but the other sites all redirectet to the new site.

I then tried the file posted above and with this one the requests stale when I tried to access the different websites and at some point they return a proxy error because of an invalid response (Error reading from remote server). And I have this in my error.log :

[mpm_prefork:error] [pid 20284] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

Changing the configuration of mpm_prefork doesn't do much though.

I don't have any idea what to do next. Any suggestions?

  • What exactly is the error message you see when 'all sites are down', in the browser, at the command line when you restart apache, in the logs? – Iain Feb 25 '16 at 9:10
0

This <VirtualHost *> doesn't feel right is it a typo ? perhaps <VirtualHost *:80> will be better?

This looks very strange in a standard vhost definition

ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass / http://testing.exemple.com/
ProxyPassReverse / http://testing.exemple.com/

and will almost certainly be the cause of you running out of request workers as you have created a loop, testing.example.com reverse proxies to tesing.example.com which reverse ...

Start with something simple and build out from it.

<VirtualHost *:80>
    ServerAdmin myemail@example.com
    ServerName testing.example.com
    DocumentRoot /var/atlassian/application-data/bamboo/xml-data/build-dir/DFWA-DFWAAT2-DEV

    CustomLog /var/log/apache2/testing/access.log combined
    ErrorLog /var/log/apache2/testing/error.log
</VirtualHost>
  • the <VirtualHost *> wasn't a typo. I followed the atlassian instructions here link to configure my tools and the port isn't specified. I added it and my configuration works now ! Thanks for the help!! I used the proxy statements as a test because I had no idea what to do. Your explanation clarified a bit more how mod_proxy works. – Maxime Lepers Feb 26 '16 at 11:19
1

I'm answering here to post the configuration that is now working.

What I had to do is adding the port on the proxied websites

<VirtualHost *:80>

and add the directory statement to allow access to / :

<Directory />
    require all granted
</Directory>

The vhost config file :

<VirtualHost *:80>
    ServerAdmin myemail@example.com
    ServerName example.com
    DocumentRoot /var/atlassian/application-data/bamboo/xml-data/build-dir/DFWA-DFWAAT2-DEV

    <Directory />
        require all granted
    </Directory>

    CustomLog /var/log/apache2/testing/access.log combined
    ErrorLog /var/log/apache2/testing/error.log
</VirtualHost>

Thanks again for the help @lain.

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.