Switch from Apache to Nginx

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 "/opt/bitnami/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.

If you want to switch the Web server, follow these steps depending on your installation type:

Approach A: Bitnami installations using system packages

  • Stop Apache and disable the Apache service:

      $ sudo /opt/bitnami/ stop apache
      $ sudo mv /etc/monit/conf.d/apache.conf /etc/monit/conf.d/apache.conf.disabled
  • Enable the NGINX service:

      $ sudo mv /etc/monit/conf.d/nginx.conf.disabled /etc/monit/conf.d/nginx.conf
  • Reload Gonit configuration:

      $ sudo gonit reload

Approach B: Self-contained Bitnami installations

  • Stop and disable the Apache service:

      $ sudo /opt/bitnami/ stop apache
      $ mv /opt/bitnami/apache2/scripts/ /opt/bitnami/apache2/scripts/
  • Enable and start NGINX:

      $ mv /opt/bitnami/nginx/scripts/ /opt/bitnami/nginx/scripts/
      $ /opt/bitnami/ start nginx
Last modification January 3, 2023