This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:proxy:lsws-as-a-proxy-rewrite-native [2017/10/16 18:30] (current)
Jackson Zhang created
Line 1: Line 1:
 +====== How to set up the server as a proxy via rewrite rules ======
 +  - Log in to the LSWS GUI. The default address is http://​IP:​7080
 +  - Go to Configuration -> Virtual Hosts and click on the Virtual Host that is going to be used as the proxy.
 +  - In the Virtual Host configuration,​ go to the External App tab and hit Add.
 +  - Select Web Server from the drop down list.
 +  - On the following page, fill in the following and hit Save:
 +    * Name - Any unique external app name. It should not start with <​code>​http://</​code>​
 +    * Address - The IP:PORT or UDS socket of the backend server. It cannot be a domain name.
 +    * Max Connections - The maximum number of concurrent connections to this Web Server at any time.
 +    * Initial Request Timeout (secs) - The maximum time in seconds the server will wait for a response.
 +    * Retry Timeout (secs) - The period of time that the server waits before retrying a request.
 +  - After saving, go to the Rewrite Tab and hit Edit.
 +  - Change the following and hit Save:
 +    * Enable Rewrite - Yes
 +      * Note: This allows the rewrite rules to be processed in .htaccess.
 +  - After saving, go to the General Tab -> HT Access and hit Edit.
 +    * Allow Override - Make sure all boxes are checked, except “None”.
 +    * Access File Name - Type in .htaccess
 +  - Next, go to the Document Root and create a file named .htaccess.
 +  - In Shell or an Editor, edit the .htaccess file and add the following:
 +    * <​nowiki>​RewriteRule (.*) http://<​EXTERNAL_APP_NAME>/​$1 [P]</​nowiki>​
 +      * Note: be sure to set it as a 1:1 copy of the External App made previously.
 +  - Once all of the  steps above have been completed, perform a Graceful Restart for the changes to take effect.
 +The URL for the vhost should now act as a proxy for the External App Web Server that was just set up.
  • Admin
  • Last modified: 2017/10/16 18:30
  • by Jackson Zhang