cPanel+Litespeed+Proxied mod_perl

sip

Well-Known Member
#1
Hello,

I switched to LSWS and found it excellent. Soon another server is going to be switched. Both are primarily php sites.

I have one cPanel server where few of our own sites are running under proxied mod_perl on port82 using mod_proxy of apache. While trying to migrate our own server to LSWS we had issues with those sites.

Is there a How to for this to get working (i can contact DC and tell them to take a look) so that sooner or later i can migrate this server to LSWS with proxied mod_perl Apache.

cPanel default Apache + proxied mod_perl Apache works fine.
 

sip

Well-Known Member
#3
Alias /perl passes to (using mod_proxy) mod_perl apache running 1.3x httpd and 1.29/1.3 mod_perl
Extension is cgi and url's have query string also

so script.cgi?t=something;sid=;page=xyz.html
or could just be script.cgi (normally on POST)
 

mistwang

LiteSpeed Staff
#4
LiteSpeed can pass certain request to backend Apache running on a different port.

http://www.litespeedtech.com/docs/webserver/config/general/#apacheHandledContent

For example, you have Apache run on port 78, in LiteSpeed, "Apache Port Offset" is set to "2", so LiteSpeed will run on port 80, if set "Apache Handled Content" to ".cgi", LiteSpeed will forward all requests with suffix "cgi" to backend Apache.

It probably is different from your current setup, which the second Apache mod_perl instance probably is not managed by cPanel, but a custom Apache setup. LiteSpeed setup have everything controlled by cPanel sharing the same httpd.conf.

Make sure to set SSL port to 441 to make LiteSpeed use port 443.
 

sip

Well-Known Member
#5
Yes it's a custom compile and not cPanel's Apache as it's an overkill to run mod_perl from same instance of apache. So this is not possible i guess as of now?
 

mistwang

LiteSpeed Staff
#6
You can use rewrite rule to tell LSWS to proxy request to the target Apache instance.
What you need to do is to define a "Web Server" external application from LSWS web console, with name of "127.0.0.1:82". Then define a rewrite rule like

RewriteRule (.*)\.cgi$ http://127.0.0.1:82/$1 [P]
 

sip

Well-Known Member
#7
Hello,

Where exactly the rewrite rule has to be defined in LSWS?
I would want that all requests with

/perl/

are handled by mod_perl apache running on port 82.
The application runs fine from LSWS but i want it to be running through mod_perl apache transparently.
 

sip

Well-Known Member
#9
Hello,

I would want to:

Run LSWS for all content except the one that i want to pass to 127.0.0.1:82 (mod_perl Apache)

The content that i want to pass to 127.0.0.1:82 has url like:

http://somedomain.tld/perl/somdirectory/.../script.cgi?querystring

Alias /perl/ /home/cpanelusername/public_html/cgi-bin/

So basically anything with

/perl
in the URL has to go to mod_perl apache on port 82.

How do i go about this. I did setup the web server with 127.0.0.1:82 and did include the rewrite rule as suggested in earlier post but don't see access being passed to backend. In the admin area of the mod_perl script i still see:

Running under mod_perl: No
and
SERVER_PORT => 80
SERVER_PROTOCOL => HTTP/1.1
SERVER_SOFTWARE => LiteSpeed

So nothing served from 127.0.0.1:82 mod_perl apache.
Wish LSWS had obeyed ProxyPass and ProxyPassReverse.

I would want to use the 127.0.0.82 transparently.
PS: I have confirmed the Enterprise Version of LSWS with DC so this server would be switching to that.

Regards
 
Last edited:

mistwang

LiteSpeed Staff
#10
add rewrite rule

RewriteRule /(perl.*)$ http://127.0.0.1:82/$1 [P]

at vhost configuration level.

If you use LiteSpeed with cPanel by reading httpd.conf, I would suggest use "Apache Handled Content" I suggested earlier, especially for shared hosting. For single large web site, you can use the rewrite rule.
 
A

annoumure

Guest
#11
cPanelLitespeedProxied mod_perl

If you wrote the above code then the perl side of your question should be easy. Continuing in the same vane just add another hash that points to the URI of an image file. The javascript code I cant help with.
 
Top