apache reverse proxy

Discussion in 'HOWTO-Related Questions' started by vtapas, Apr 14, 2010.

  1. vtapas

    vtapas New Member

    I used following how to
    http://www.howtoforge.com/apache_reverse_proxy_ispconfig

    I did not used ispconfig.

    I did same as it mentioned.
    But the warning are still there.
    Code:
     Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    [Wed Apr 14 13:09:34 2010] [warn] NameVirtualHost *:80 has no VirtualHosts
    
    /etc/apache2/apache2.conf looks like
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerName mydomain.in
            DocumentRoot /var/www
            ProxyRequests Off
           <Proxy *>
           Order deny,allow
           Allow from all
           </Proxy>
         ProxyPass /domu1 http://192.168.1.13/
         ProxyPass /domu2 http://192.168.1.14/
         ProxyPass /domu3   http://192.168.1.15/
         ProxyPass /domu4      http://192.168.1.16/
         ProxyPassReverse /domu1 http://192.168.1.13/
         ProxyPassReverse /domu2 http://192.168.1.14/
         ProxyPassReverse /domu3   http://192.168.1.15/
         ProxyPassReverse /domu4      http://192.168.1.16/
    </VirtualHost>
    
    There is no line that has NameVirtualHost in sites-available/default
    file.It looks like following in my case
    Code:
    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    
    What else should I check in for? So that the warning goes. Everything else is working fine.I can see my servers running on DomU's
    on Intranet and outside as well.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Modify apache2.conf as follows:

    Code:
    NameVirtualHost *[COLOR="Red"]:80[/COLOR]
    <VirtualHost *[COLOR="Red"]:80[/COLOR]>
            ServerName mydomain.in
            DocumentRoot /var/www
            ProxyRequests Off
           <Proxy *>
           Order deny,allow
           Allow from all
           </Proxy>
         ProxyPass /domu1 http://192.168.1.13/
         ProxyPass /domu2 http://192.168.1.14/
         ProxyPass /domu3   http://192.168.1.15/
         ProxyPass /domu4      http://192.168.1.16/
         ProxyPassReverse /domu1 http://192.168.1.13/
         ProxyPassReverse /domu2 http://192.168.1.14/
         ProxyPassReverse /domu3   http://192.168.1.15/
         ProxyPassReverse /domu4      http://192.168.1.16/
    </VirtualHost>
     
  3. vtapas

    vtapas New Member

    Ya I did that and after a reboot I got following
    Code:
    /etc/apache2# /etc/init.d/apache2 reload
    Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    [Thu Apr 15 17:53:09 2010] [warn] NameVirtualHost *:80 has no VirtualHost
    
    Here is how my apache2.conf looks like

    Code:
    # Include generic snippets of statements
    Include /etc/apache2/conf.d/
    NameVirtualHost *:80
    <VirtualHost *:80>
            ServerName lan.in
            DocumentRoot /var/www
            ProxyRequests Off
           <Proxy *>
           Order deny,allow
           Allow from all
           </Proxy>
         ProxyPass /domu1                http://192.168.1.13/
         ProxyPass /domu2                http://192.168.1.14/
         ProxyPass /domu3                http://192.168.1.15/
         ProxyPass /domu4                http://192.168.1.16/
         ProxyPassReverse /domu1     http://192.168.1.13/
         ProxyPassReverse /domu2     http://192.168.1.14/
         ProxyPassReverse /domu3     http://192.168.1.15/
         ProxyPassReverse /domu4     http://192.168.1.16/
    </VirtualHost>
    # Include the virtual host configurations:
    #Include /etc/apache2/sites-enabled/
    #Include /etc/phpmyadmin/apache.conf
    
     
  4. vtapas

    vtapas New Member

    Okay here is what it worked I got it some where so posting it if some has same problem

    comment that NameVirtualHost line above in apache2.conf
    and put
    servername directive in same file apache2.conf at the end.Then reload apache2 it should work.
     
  5. vtapas

    vtapas New Member

    Hi yes you are right.Even then now I am posting a solution since by now I have solved the problem.
    http://swik.net/MySQL/Planet+MySQL/...+behind+a+Reverse+Proxy+Server+(Apache)/dcslr

    I am posting so that if some one else faces the same problem they may get a solution.Which is mentioned on the above link you can go there directly and read it.
    Code:
    When you install drupal on a server which is behind apache reverse proxy you need to tell that drupal installation about the presence of reverse proxy in your nework.
    That is the core of the problem.
    To achieve this you need to do do following
    in your drupal installation folder go to sites/default/settings.php
    and change the following
    
    $base_url="http://www.mydomain.com/;
    then 
    $cookie_domain = 'proxyserver.yourdomain.com';
    
    if above both are same then place them same values
    then
    uncomment 
    
    $conf = array(
    
    then
    uncomment 
    'reverse_proxy' => TRUE,
    
    then 
    'reverse_proxy_addresses' => array('192.168.0.1',),
    replace it by IP of your apache reverse proxy 
    
    and uncomment below it
    );
    
    Hopefully it should work.
    Keywords to search for this are if you are using drupal
    "drupal behind apache reverse proxy"

    You can get same problem if you do not use drupal the thing is any web server running behind a proxy needs to know how to handle requests which are forwarded by proxy.
    Some one if comes across same situation do reply here make a blog etc it will help others.
     

Share This Page