nativeInstallernoalyss

Modify the Apache port

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "installdir/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Approach A: Bitnami installations using system packages

HTTP port

Under the default configuration, Apache will listen for HTTP requests on port 80. To change the port number, follow the steps below:

  • Edit the installdir/apache2/conf/httpd.conf file and modify the value specified in the Port directive. For example:

    Listen 8080
    
    ServerName localhost:8080
    
  • Edit the installdir/apache2/conf/bitnami/bitnami.conf file and modify the value specified in the VirtualHost directive. For example:

    <VirtualHost _default_:8080>
    
  • Edit all non-SSL virtual host files inside the installdir/apache2/conf/vhosts/ directory and modify the value specified in the VirtualHost directive. For example:

    NOTE: Do not edit virtual host files containing the SSLEngine on directive.

    <VirtualHost 127.0.0.1:8080 _default_:8080>
    
  • Restart the Apache server for changes to take effect:

    $ sudo installdir/ctlscript.sh restart apache
    

HTTPS port

Apache listens for HTTPS requests on port 443. To change the port number, follow the steps below:

  • Edit the installdir/apache2/conf/bitnami/bitnami-ssl.conf file and modify the value specified in the VirtualHost directive. For example:

    <VirtualHost _default_:8443>
    
  • Edit all SSL virtual host files inside the installdir/apache2/conf/vhosts/ directory and modify the value specified in the VirtualHost directive. For example:

    NOTE: Only edit virtual host files containing the SSLEngine on directive.

    <VirtualHost 127.0.0.1:8443 _default_:8443>
    
  • Restart the Apache server for changes to take effect:

    $ sudo installdir/ctlscript.sh restart apache
    

Approach B: Self-contained Bitnami installations

NOTE: On Linux and MacOS platforms, install the stack as the root user to use a port number under 1024.

HTTP port

Under the default configuration, Apache will listen for HTTP requests on port 80. To change the port number, follow the steps below:

  • Edit the installdir/apache2/conf/httpd.conf file and modify the value specified in the Port directive. For example:

    Listen 8080
    
    ServerName localhost:8080
    
  • Edit the installdir/apache2/conf/bitnami/bitnami.conf file and modify the value specified in the VirtualHost directive. For example:

    <VirtualHost _default_:8080>
    
  • Restart the Apache server for changes to take effect:

    $ sudo installdir/ctlscript.sh restart apache
    

HTTPS port

Apache listens for HTTPS requests on port 443. To change the port number, follow the steps below:

  • Edit the installdir/apache2/conf/bitnami/bitnami.conf file and modify the value specified in the Port directive. For example:

    Listen 8443
    
    <VirtualHost _default_:8443>
    
  • Restart the Apache server for changes to take effect.

    $ sudo installdir/ctlscript.sh restart apache
    
Last modification June 9, 2020