azurewordpress-pro

Create a custom PHP application

Many users run a Bitnami stack as a development environment for their own PHP projects (as opposed to running third-party applications such as Joomla! or WordPress). To deploy your PHP application in this environment, follow these steps.

Create the same structure used by Bitnami when installing Bitnami PHP applications. To do this, follow these steps:

  • Run the following commands to create the directories and assign the necessary permissions.

      $ sudo mkdir /opt/bitnami/myapp
      $ sudo chown -R bitnami:daemon /opt/bitnami/myapp
      $ sudo chmod -R g+w /opt/bitnami/myapp
    
  • Create and edit the /opt/bitnami/nginx/conf/server_blocks/myapp-server-block.conf file and add the configuration block shown below:

      server {
          # Port to listen on, can also be set in IP:PORT format
          listen 80 default_server;
          root /opt/bitnami/myapp;
          # Catch-all server block
          # See: https://nginx.org/en/docs/http/server_names.html#miscellaneous_names
          server_name _;
          include  "/opt/bitnami/nginx/conf/bitnami/*.conf";
      }
    
  • Create and edit the /opt/bitnami/nginx/conf/server_blocks/myapp-https-server-block.conf file and add the configuration block shown below:

      server {
          # Port to listen on, can also be set in IP:PORT format
          listen 443 ssl default_server;
          root /opt/bitnami/myapp;
          # Catch-all server block
          # See: https://nginx.org/en/docs/http/server_names.html#miscellaneous_names
          server_name _;
          ssl_certificate      bitnami/certs/server.crt;
          ssl_certificate_key  bitnami/certs/server.key;
          include  "/opt/bitnami/nginx/conf/bitnami/*.conf";
      }
    
  • Restart the NGINX server:

      $ sudo /opt/bitnami/ctlscript.sh restart nginx
    

    You should now be able to access the application at http://SERVER-IP/.

Once you have created and deployed your custom PHP application, you can also proceed to create and integrate a database with your application.

Last modification February 9, 2023