Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2024-03-28, 20:54:36

Author Topic: How to redirect subdomain to specific port without changing url  (Read 12511 times)

0 Members and 1 Guest are viewing this topic.

Offline Mansoor

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Hi
I have a centos 6.9 server with kloxo-mr7 installed and everything works like a charm but i have a problem, i have a service on port 660 and my senior said it has to be loaded on sub.domain.com without need of entering port number (if anybody enter sub.domain.com data should be loaded from myserver:660 without changing address bar url to 660 port)

what i did till now:
made sub.domain.com from kloxo panel
searched couple of days to find the solution and everywhere people suggested to setup in apache virtualhost but i couldn't find it anywhere in server (config files which includes virtualhost)

thanks for your kind help in advance

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Maybe need 'proxy' feature like nginx-proxy. In nginx-proxy, nginx listen port 80 and communicate to apache with port 30080 (default by Kloxo-MR).

Another alternative with using mod_proxy in apache.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline Mansoor

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
I'm on apache right now and since i can't change webserver at this point (several scripts are up and configured & i can't take risk of losing any of them) i think using apache method would be the best but i couldn't find a way to do so.

found this solution but i don't know where shoud i enter this, because httpd.conf doesn't look like what i've seen till now and also there are 3 different httpd.conf files in server in different paths:
Code: [Select]
<VirtualHost *:80>
    ServerAdmin me@mydomain.com
    ServerName dev.mydomain.com
    ProxyPreserveHost On

    # setup the proxy
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:660/
    ProxyPassReverse / http://localhost:660/
</VirtualHost>
« Last Edit: 2019-08-09, 09:30:25 by Mansoor »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Create subdomain for this purpose. And then copy '/opt/configs/apache/conf/domains/<subdomain>.conf' to '/opt/configs/apache/conf/customs/<subdomain>.conf'. Modified '<subdomain>.conf' inside this customs dir.

Modified content inside '<VirtualHost></VirtualHost>' under '## web for'. After that, run 'sh /script/fixweb; sh /script/restart-web'.

Note:
- make sure to choose 'proxy_fcgi_event' for 'PHP Type (for Apache)' in 'Webserver configure'.
- Modified '<IfVersion >= 2.4><IfModule mod_proxy_fcgi.c></IfModule></IfVersion>'
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline Mansoor

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Thanks for your kind help and really sorry for my childish kind questions, i didn't take a nap drom couple of nights that's why maybe i ask some stupid questions.
this is my proxy block code in virtualhost:

Code: [Select]
<IfVersion >= 2.4>
                <IfModule mod_proxy_fcgi.c>
                        ProxyRequests Off
                        ProxyErrorOverride On
                        ProxyPass /error !
                        ErrorDocument 500 /error/500.html
                        <Proxy "unix:/opt/configs/php-fpm/sock/php-apache.sock|fcgi://localhost">
                                ProxySet timeout=300
                                ProxySet connectiontimeout=300
                                # need disablereuse=on for 'ondemand'
                                ProxySet disablereuse=on
                                ProxySet max=25
                                ProxySet retry=0
                        </Proxy>
                        <FilesMatch \.php$>
                                SetHandler proxy:fcgi://localhost
                        </FilesMatch>
                </IfModule>
        </IfVersion>

may you help me to do my changes in file?

what i need is:
sub.domain.tld to be pointed to myserver:660 without changing url in addressbar

thanks agin for your kind help

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Try:
Code: [Select]
<IfVersion >= 2.4>
#<IfModule mod_proxy_http.c>
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:660/
ProxyPassReverse / http://localhost:660/
#</IfModule>
</IfVersion>
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline Mansoor

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
thanks again, i made the changes but it doesn't made any change in subdomain behaviour
maybe i made a mistake in copying file & path
i've did like this:

Code: [Select]
cp /opt/configs/apache/conf/domains/sub.domain.com.conf /opt/configs/apache/conf/customs/sub.domain.com.conf.Modified
is it correct or i misunderstood and did it in a wrong way?

one more thing, there is no "proxy_fcgi_event" in server php settings, i've selected "fcgid_event"
« Last Edit: 2019-08-09, 10:38:01 by Mansoor »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,807
  • Karma: +119/-11
  • Gender: Male
    • View Profile
    • MRatWork Forum
Inform here 'sh /script/sysinfo'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline Mansoor

  • Junior Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
sadly couldn't do the job at that time through your way so i did that using rewrite mode on .htaccess file.
thanks for your help anyway.

 


Top 4 Global Search Engines:    Google    Bing    Baidu    Yahoo
Click Here

Page created in 0.077 seconds with 22 queries.

web stats analysis