Search code examples
linuxapacheubuntuapache2suse

How to perform Apache 2 config migration from Linux SUSE to Ubuntu?


I'm a newbie with Apache configurations. I need to migrate a web tool running on Linux SUSE with Apache 2 to Ubuntu. It is currently using an external httpd.conf located in some other place on the machine, set as APACHE_HTTPD_CONF variable in /etc/sysconfig/apache2. It looks like there is no /etc/sysconfig/apache2, and also no APACHE_HTTPD_CONF variable in any of the files in /etc/apache2/ on Ubuntu. How can I configure it correctly?


Solution

  • In ubuntu, at /etc/apache2 you have the possibility to config several criteria of things, such as:

    • conf
    • mods
    • sites

    These have a folder of -available (sites-available, for example) and a folder of -enabled (sites-enabled, for example). You will definitely need to define your sitename.conf file in sites-available and then run

    sudo a2ensite sitename
    

    to enable it. Similarly, you will need to enable mods and conf. Whenever you performed some large change and intend to test or use Apache, restart it:

    sudo service apache2 restart
    

    There is also an apache2.conf file for general Apache settings.

    In your scenario I would recommend copying the content of your httpd.conf into /etc/apache2/sites-available/sitename.conf and then run

    sudo a2ensite sitename
    sudo service apache2 restart
    

    This copies the config file from /etc/apache2/sites-available to /etc/apache2/sites-enabled and restarts Apache. You will also need to edit /etc/hosts to define your sitename to be loaded from 127.0.0.1.