GNU/Linux >> Tutoriels Linux >  >> Panels >> Panels

Comment exécuter ISPConfig 2 sur le port 80 à l'aide de la fonctionnalité de proxy inverse d'Apache (Debian Etch)

Exécuter ISPConfig 2 sur le port 80 à l'aide de la fonctionnalité de proxy inverse d'Apache (Debian Etch)

Cet article montre comment vous pouvez configurer un système Debian Etch sur lequel le panneau de contrôle d'hébergement Web ISPConfig 2 est installé afin que ISPConfig soit accessible sur le port 80. Par défaut, ISPConfig utilise le port 81 qui est un port non standard et est bloqué par certains pare-feu et FAI. En utilisant le module mod_proxy d'Apache, nous pouvons éviter ce problème. Cela nous permet de créer un proxy inverse qui peut récupérer les pages d'ISPConfig sur le port 81.

Remarque :ce tutoriel concerne uniquement ISPConfig 2, il n'est pas compatible avec ISPConfig 3. Pour ISPConfig 3, un plugin inverse Nginx est disponible sur github.

Je n'émets aucune garantie que cela fonctionnera pour vous !

1 Remarque préliminaire

J'ai testé cela sur un système Debian Etch. Bien que certaines commandes de ce didacticiel soient spécifiques à Debian, la plupart d'entre elles peuvent être appliquées à toute autre distribution Linux (en particulier la configuration Apache).

J'utilise le nom d'hôte ispconfig.example.com dans ce tutoriel. L'objectif de ce didacticiel est d'accéder à ISPConfig sous l'URL http://ispconfig.example.com. Je vais montrer comment faire cela dans deux chapitres distincts :un chapitre si ISPConfig est installé sous http://ispconfig.example.com:81 (http), et un chapitre si ISPConfig est installé sous https://ispconfig .exemple.com:81 (https).

2 ISPConfig utilisant http (http://ispconfig.example.com:81)

Afin de créer un proxy inverse pour les requêtes http, nous avons besoin des modules Apache mod_proxy et mod_proxy_http. Ceux-ci sont déjà installés dans une installation standard Debian Etch Apache 2.2, il nous suffit donc de les activer :

a2enmod proxy
a2enmod proxy_http

Ensuite, il faut recharger Apache :

/etc/init.d/apache2 force-reload

Ensuite, nous devons configurer Apache. Ouvrez /etc/apache2/apache2.conf et recherchez cette section :

vi /etc/apache2/apache2.conf
[...]
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

<Directory /var/www/sharedip>
    Options +Includes -Indexes
    AllowOverride None
    AllowOverride Indexes AuthConfig Limit FileInfo
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
</Directory>
[...]

Juste avant cette section, nous ajoutons les lignes suivantes :

NameVirtualHost *
<VirtualHost *>
        ServerName ispconfig.example.com
        DocumentRoot /var/www/
        ProxyRequests Off

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

        ProxyPass / http://ispconfig.example.com:81/
        ProxyPassReverse / http://ispconfig.example.com:81/
</VirtualHost>

pour qu'il ressemble à ceci :

[...]
NameVirtualHost *
<VirtualHost *>
        ServerName ispconfig.example.com
        DocumentRoot /var/www/
        ProxyRequests Off

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

        ProxyPass / http://ispconfig.example.com:81/
        ProxyPassReverse / http://ispconfig.example.com:81/
</VirtualHost>

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

<Directory /var/www/sharedip>
    Options +Includes -Indexes
    AllowOverride None
    AllowOverride Indexes AuthConfig Limit FileInfo
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
</Directory>
[...]

Redémarrez ensuite Apache :

/etc/init.d/apache2 restart

Si vous recevez un avertissement comme celui-ci :

server1:~/ispconfig/httpd/conf# /etc/init.d/apache2 restart
Forcing reload of web server (apache2)...[Tue May 22 23:23:12 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Tue May 22 23:23:22 2007] [warn] NameVirtualHost *:0 has no VirtualHosts

alors vous pouvez soit commenter la ligne Include /etc/apache2/sites-enabled/ dans /etc/apache2/apache2.conf :

vi /etc/apache2/apache2.conf
[...]
# Include the virtual host configurations:
#Include /etc/apache2/sites-enabled/
[...]

soit vous commentez la ligne NameVirtualHost * au début de /etc/apache2/sites-available/default :

vi /etc/apache2/sites-available/default
#NameVirtualHost *
[...]

Redémarrez Apache :

/etc/init.d/apache2 restart

Les avertissements devraient avoir disparu maintenant.

Enfin, nous devons modifier le fichier de configuration ISPConfig /home/admispconfig/ispconfig/lib/config.inc.php. Vous devriez y trouver quelque chose comme ça :

vi /home/admispconfig/ispconfig/lib/config.inc.php
[...]
if(isset($_SERVER['HTTP_HOST'])){
  $go_info["server"]["server_url"] = 'http://'.$_SERVER['HTTP_HOST'];
} else {
  $go_info["server"]["server_url"] = "http://ispconfig.example.com:81";
}
[...]

Modifiez-le pour qu'il ressemble à ceci :

[...]
//if(isset($_SERVER['HTTP_HOST'])){
//  $go_info["server"]["server_url"] = 'http://'.$_SERVER['HTTP_HOST'];
//} else {
  $go_info["server"]["server_url"] = "http://ispconfig.example.com";
//}
[...]

C'est ça. Ouvrez un navigateur et tapez http://ispconfig.example.com, et vous devriez voir l'invite de connexion ISPConfig.

3 ISPConfig utilisant https (https://ispconfig.example.com:81)

Afin de créer un proxy inverse pour les requêtes http, nous avons besoin des modules Apache mod_proxy et mod_proxy_http. Ceux-ci sont déjà installés dans une installation standard Debian Etch Apache 2.2, il nous suffit donc de les activer :

a2enmod proxy
a2enmod proxy_http

Parce que notre proxy inverse Apache doit pouvoir "parler" à un site https (https://ispconfig.example.com:81), nous avons également besoin des modules mod_proxy_connect et mod_ssl :

a2enmod proxy_connect
a2enmod ssl

Ensuite, il faut recharger Apache :

/etc/init.d/apache2 force-reload

Ensuite, nous devons configurer Apache. Ouvrez /etc/apache2/apache2.conf et recherchez cette section :

vi /etc/apache2/apache2.conf
[...]
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

<Directory /var/www/sharedip>
    Options +Includes -Indexes
    AllowOverride None
    AllowOverride Indexes AuthConfig Limit FileInfo
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
</Directory>
[...]

Juste avant cette section, ajoutez les lignes suivantes :

NameVirtualHost *
<VirtualHost *>
        ServerName ispconfig.example.com
        DocumentRoot /var/www/
        ProxyRequests Off

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

        ProxyPass / https://ispconfig.example.com:81/
        ProxyPassReverse / https://ispconfig.example.com:81/

        SSLProxyEngine on
        AllowCONNECT 81
</VirtualHost>

pour qu'il ressemble à ceci :

[...]
NameVirtualHost *
<VirtualHost *>
        ServerName ispconfig.example.com
        DocumentRoot /var/www/
        ProxyRequests Off

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

        ProxyPass / https://ispconfig.example.com:81/
        ProxyPassReverse / https://ispconfig.example.com:81/

        SSLProxyEngine on
        AllowCONNECT 81
</VirtualHost>

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

<Directory /var/www/sharedip>
    Options +Includes -Indexes
    AllowOverride None
    AllowOverride Indexes AuthConfig Limit FileInfo
    Order allow,deny
    Allow from all
    <Files ~ "^\.ht">
    Deny from all
    </Files>
</Directory>
[...]

Redémarrez ensuite Apache :

/etc/init.d/apache2 restart

Si vous recevez un avertissement comme celui-ci :

server1:~/ispconfig/httpd/conf# /etc/init.d/apache2 restart
Forcing reload of web server (apache2)...[Tue May 22 23:23:12 2007] [warn] NameVirtualHost *:0 has no VirtualHosts
[Tue May 22 23:23:22 2007] [warn] NameVirtualHost *:0 has no VirtualHosts

alors vous pouvez soit commenter la ligne Include /etc/apache2/sites-enabled/ dans /etc/apache2/apache2.conf :

vi /etc/apache2/apache2.conf
[...]
# Include the virtual host configurations:
#Include /etc/apache2/sites-enabled/
[...]

soit vous commentez la ligne NameVirtualHost * au début de /etc/apache2/sites-available/default :

vi /etc/apache2/sites-available/default
#NameVirtualHost *
[...]

Redémarrez Apache :

/etc/init.d/apache2 restart

Les avertissements devraient avoir disparu maintenant.

Enfin, nous devons modifier le fichier de configuration ISPConfig /home/admispconfig/ispconfig/lib/config.inc.php. Vous devriez y trouver quelque chose comme ça :

vi /home/admispconfig/ispconfig/lib/config.inc.php
[...]
if(isset($_SERVER['HTTP_HOST'])){
  $go_info["server"]["server_url"] = 'https://'.$_SERVER['HTTP_HOST'];
} else {
  $go_info["server"]["server_url"] = "https://ispconfig.example.com:81";
}
[...]

Modifiez-le pour qu'il ressemble à ceci :

[...]
//if(isset($_SERVER['HTTP_HOST'])){
//  $go_info["server"]["server_url"] = 'https://'.$_SERVER['HTTP_HOST'];
//} else {
  $go_info["server"]["server_url"] = "http://ispconfig.example.com";
//}
[...]

Assurez-vous qu'il lit bien http://ispconfig.example.com, et non https://ispconfig.example.com !

C'est ça. Ouvrez un navigateur et tapez http://ispconfig.example.com, et vous devriez voir l'invite de connexion ISPConfig.

  • Module Apache mod_proxy :http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
  • Apache :http://httpd.apache.org
  • ISPConfig :http://www.ispconfig.org
  • Debian :http://www.debian.org

Panels
  1. Comment sauvegarder les fichiers de configuration système à l'aide de la fonction de sauvegarde WHM ?

  2. Annonces forcées sur ISPConfig avec Debian Etch

  3. Comment configurer suPHP sur un serveur ISPConfig basé sur Debian Etch

  4. Comment activer plusieurs sites HTTPS pour une adresse IP sur Debian Etch à l'aide d'extensions TLS

  5. Comment installer Odoo 11 sur Debian 9 avec Nginx comme proxy inverse

Comment configurer Nginx en tant que proxy inverse pour Apache sur Debian 11

Comment installer ISPConfig sur Debian 11

Comment configurer Mailman avec Debian et ISPConfig

Comment installer Drupal 5.6 sur Debian Etch avec ISPConfig

Comment exécuter vos propres serveurs DNS (primaires et secondaires) avec ISPConfig 3 (Debian Squeeze)

Comment installer ISPConfig sur Debian 10 ?