How to publish a Wisej App using Apache as a reverse proxy.
There are a few steps required to deploy to deploy a Wisej.NET app to Apache on .NET Core. use the following Visual Studio Publishing link to generate a build. Then proceed with Basic Steps.
After generating a build using the Visual Studio Publishing link above, copy the executable, resource files, and referenced DLLs to the folder they will run in.
Test that the deployment works using the dotnet start AppName command.
If the application is deployed as an executable, ensure the executable has the execute permission and run sudo ./AppName.
3. After verifying the app runs, you will need to configure the app to run on startup. systemd can be used to create a service file to start and monitor the underlying web app.
systemd is an init system that provides many powerful features for starting, stopping, and managing processes on Linux systems. Click here to make a service file.
All Apache needs is an address and a port. In the httpd.conf file define the URL for your application and assign the URL:port of the actual Wisej application to the ProxyPass setting.
The configurations in this book are minimal examples, use the full Apache guide to determine how to configure your Apache server.
This is all you need for Apache to dispatch the requests to the Wisej.NET application.
Deploying a Wisej 2.x application to Apache is similar the the IIS deployment in regards to the files to copy to the production machine.
Create the application directory on the deployment server
Create the /bin directory in the application's directory on the deployment server
Copy all the assemblies from your local /bin to the server's /bin (no need to copy xml and pdb files)
Copy the /Themes folder if you have custom themes or mixins
Copy the /Images folder if you have images that need to be served as URLs
Copy the /App_Data folder if your application uses it
Copy Web.config
Copy Default.html (and other html files you use sub-applications)
Copy Default.json (and other json configuration files if you use sub-applications)
Copy favicon.ico.
Notice that step 1 is different from IIS because Apache never loads the actual application, instead it acts as a Reverse Proxy dispatching requests to the web application listening on another internal port.
The actual Wisej application must be running and listening for requests in a separate process on the local machine or a remote machine. It can be either an IIS process or a Self Hosted process (may also run in a Docker container).
All Apache needs is an address and a port. In the httpd.conf file define the URL for your application and assign the URL:port of the actual Wisej application to the ProxyPass setting.
The configurations in this book are minimal examples, use the full Apache guide to determine how to configure your Apache server.
This is all you need for Apache to dispatch the requests to the Wisej.NET application.
Apache can also serve as a load balancer out of the box. Instead of setting the ProxyPass property to the actual Wisej server, assign it to a balancer group that defines the load balancing rotation.
Note that in the sample above we added a cookie ROUTEID with the name of the node to bind a specific server to a client in order to achieve the required sticky session functionality.
If you are deploying on a Linux distribution or on MacOS, make sure libgdiplus is installed.