pallinarozza
Verified User
- Joined
- Dec 21, 2019
- Messages
- 5
Hi at all,
Yesterday I was trying to add reverse proxy on OpenLiteSpeed for my NET Core application, but there was no guide for DirectAdmin. Today I just figured out how to do it.
This guide will cover only the setup part on DirectAdmin.
My net core app runs at 127.0.0.1:5000
Usefull info about the configuration (taken from OpenLiteSpeed console):
maxConns - Max Connections : (Number valid range: 1 - 2000)
initTimeout - Initial Request Timeout (secs) : Number valid range >= 1
retryTimeout - Retry Timeout (secs): Number valid range >= 0
respBuffer - Response Buffering: Numbers valid: 0 or 1 or 2
Yesterday I was trying to add reverse proxy on OpenLiteSpeed for my NET Core application, but there was no guide for DirectAdmin. Today I just figured out how to do it.
This guide will cover only the setup part on DirectAdmin.
My net core app runs at 127.0.0.1:5000
- First at all login on your DirectAdmin dashboard.
- Go in Custom HTTPD Configurations.
- Click on openlitespeed.conf on your domain line.
- Click on Customize
- Click on CUSTOM2(Appears in scripthandler{} section. ) and paste this:
Code:add proxy:Backend html
- Click on CUSTOM5(Appears in rewrite{} section. ) and paste this:
Code:RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC] RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]
- Click on CUSTOM7(Appears at the end of the virtualHost.) and paste this:
Code:extprocessor Backend{ type proxy address 127.0.0.1:5000 maxConns 2000 initTimeout 20 retryTimeout 0 respBuffer 0 } context / { type proxy handler Backend addDefaultCharset off }
You can configure "maxConns", "initTimeout", "retryTimeout" and "respBuffer" parameters or copy and paste this. At the end of the post you can find some info about these parameters.
- Click on SAVE (if you see some error like "log file is not writable" or "failed to set up error log!" or " failed to set up access log!" you can ignore them.
- Click on BACK and click again on BACK
- Click on ./build rewrite_confs
- Finish. Start your webApp and you will see your website showing the webApp
Usefull info about the configuration (taken from OpenLiteSpeed console):
maxConns - Max Connections : (Number valid range: 1 - 2000)
Specifies the maximum number of concurrent connections that can be established between the server and an external application. This setting controls how many requests can be processed concurrently by an external application, however, the real limit also depends on the external application itself. Setting this value higher will not help if the external application is not fast enough or cannot scale to a large number of concurrent requests.
Tip(s):
- Setting a high value does not directly translate to higher performance. Setting the limit to a value that will not overload the external application will provide the best performance/throughput.
initTimeout - Initial Request Timeout (secs) : Number valid range >= 1
Specifies the maximum time in seconds the server will wait for the external application to respond to the first request over a new established connection. If the server does not receive any data from the external application within this timeout limit, it will mark this connection as bad. This helps to identify communication problems with external applications as quickly as possible. If some requests take longer to process, increase this limit to avoid 503 error messages.
retryTimeout - Retry Timeout (secs): Number valid range >= 0
Specifies the period of time that the server waits before retrying an external application that had a prior communication problem.
respBuffer - Response Buffering: Numbers valid: 0 or 1 or 2
Specifies whether to buffer responses received from external applications. If a "nph-" (Non-Parsed-Header) script is detected, buffering is turned off for responses with full HTTP headers.
Values:
- 0 : No
- 1 : Yes
- 2 : No for Non-Parsed-Header (NPH)
Last edited: