LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > [SERVER_PORT] when using proxy-server

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2009, 12:48 PM
xendex xendex is offline
New Member
 
Join Date: May 2009
Location: Ukraine
Posts: 9
Question [SERVER_PORT] when using proxy-server

I'm using Litespeed SE(as backend for scripts, on port 8080), nginx(as frontend proxy-server, on port 80) and PHP LSAPI, where each site(domain) has own vhost, php.ini, listener with own port(8081, 8082...)
And the problem is that some php-scripts(like phpBB3, phpMyAdmin) are using port(requesting it by _SERVER['SERVER_PORT']) in the redirection URL if it's not 80 by default - so URL redirects like http://mysite.com:8081/blah.php?=blah...... lead to an error.
So is there any way to return port 80(in _SERVER['SERVER_PORT']) dy default for all vhosts instead of port mentioned in the listener for this vhost(i.e. 8081, 8082, 8083...)? And does this have to be done on Litespeed, nginx or PHP level?
I will be glad to listen to any helpful solution.

Thanks in advance!

P.S. If it'll be useful, here's example nginx config, that I'm using for each vhost:
Code:
server { 
        listen       80; 
        server_name  mysite.com; 

        location / { 
proxy_pass         http://127.0.0.1:8081/; 
proxy_redirect     off; 
proxy_set_header   Host             $host; 
proxy_set_header   X-Real-IP        $remote_addr; 
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for; 
client_max_body_size       10m; 
client_body_buffer_size    128k; 
proxy_connect_timeout      90; 
proxy_send_timeout         90; 
proxy_read_timeout         90; 
proxy_buffer_size          4k; 
proxy_buffers              4 32k; 
proxy_busy_buffers_size    64k; 
proxy_temp_file_write_size 64k; 
        } 

 # Static files location 

        location ~* ^.+.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ { 

                    root   /home/somesites/domains/mysite.com/public_html/; 

                            } 



        error_page   500 502 503 504  /50x.html; 
        location = /50x.html { 
            root   html; 
        } 

        location ~ /.ht { 
            deny  all; 
        } 
    }
Reply With Quote
  #2  
Old 06-09-2012, 10:36 PM
slene slene is offline
New Member
 
Join Date: Jun 2012
Posts: 2
Default i have same problem

the apache setting:

PHP Code:
UseCanonicalName Off
UseCanonicalPhysicalPort Off 
cannot work.

the port always use listen port, not client port.

Anyone have a solution for this?
Reply With Quote
  #3  
Old 06-11-2012, 02:11 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
a few things to note:
1. LSWS Stand Edition only reads up to 5 vhosts from Apache httpd.conf. If you have more vhosts than that, you will be unable to server others vhosts.
2. make sure LSWS listener is on 127.0.0.1:8081 (or any IP:8081).
3. _SERVER['SERVER_PORT'] is PHP environment variable. in your case, it will reflect the port backend server LSWS listens on (i.e., 8081).
Reply With Quote
  #4  
Old 06-12-2012, 12:28 AM
slene slene is offline
New Member
 
Join Date: Jun 2012
Posts: 2
In my case.

When I use apache as a backend server. and nginx as proxy.

1. apache listener 8081, nginx listener 80.
2. apache settings
UseCanonicalName Off
UseCanonicalPhysicalPort Off
3. use mod_rpaf to set real ip from HTTP-X-REAL-IP
4. the php env $_SERVER['SERVER_PORT'] is 80

When I use litespeed as a backend server. and nginx as proxy.

1. litespeed listener 8081, nginx listener 80.
2. and litespeed set Use Client IP in Header for set real ip
3. UseCanonicalName and UseCanonicalPhysicalPort cannot work in litespeed.
4. the php env $_SERVER['SERVER_PORT'] always is 8081.

Can litespeed fix this problem in new version ?
Reply With Quote
  #5  
Old 06-12-2012, 03:52 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
Why not use LSWS as frontend instead?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:38 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.