LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-03-2016, 12:32 AM   #1
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Rep: Reputation: Disabled
IP to URL redirection


Hi,

I have Apache and Tomcat Apache both are running on my server. I have also configured mod_jk connector.

I am able to access web apps of tomcat using Apache server but currenty i am accessing that like, 10.10.10.10/web now I want to redirect that to some domain like if I hit url like web.myserver.com will open 10.10.10.10/web. how can I do that?

Thanks.
 
Old 08-03-2016, 07:50 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,608

Rep: Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960Reputation: 7960
Quote:
Originally Posted by dushyantg View Post
Hi,
I have Apache and Tomcat Apache both are running on my server. I have also configured mod_jk connector.

I am able to access web apps of tomcat using Apache server but currenty i am accessing that like, 10.10.10.10/web now I want to redirect that to some domain like if I hit url like web.myserver.com will open 10.10.10.10/web. how can I do that?
You can read the "Question Guidelines" link in my posting signature, and attempt to research things on your own FIRST, before posting a question. The Apache documentation has LOTS about virtual hosting:
https://httpd.apache.org/docs/curren.../examples.html

As with other threads, please try to show some effort:
http://www.linuxquestions.org/questi...ll-4175585685/
http://www.linuxquestions.org/questi...-a-4175582122/
http://www.linuxquestions.org/questi...ue-4175583331/
 
Old 08-04-2016, 01:16 AM   #3
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
I have tried making changes in httpd.conf

using ServerAlias,ServerName,Redirect permanent, but after making changes in httpd.conf when i tried to restart services it gives error like
"Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details."

when I checked with "journalctl -xe" it shows me error like

"Aug 04 01:06:19 server.com restartsrv_httpd[25767]: AH00526: Syntax error on line 312 of /usr/local/apache/conf/httpd.conf:"

when i gone through some documentations of Apache I don't find any mistake in my Syntax as I have followed it from the documents. even I have cross checked it might be spell mistakes or extra spaces but nothing like that.
 
Old 08-04-2016, 04:01 AM   #4
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
ServerAlias has taken me little near to the thing which I required but not done yet. after using ServerAlias i can access with url such as web.myserver.com/web instead of web.myserver.com
 
Old 08-04-2016, 05:09 AM   #5
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
I found issues is with domain can any one help in this?

i have tried many things to point web.myserver.com to 10.10.10.10/web but than i found web.myserver.com is pointing to 10.10.10.10. so whatever the changes I made in httpd were not worth. is that possible to point a domains A record to 10.10.10.10/web? or any other way by which I can solve this?

Thanks

Last edited by dushyantg; 08-04-2016 at 07:31 AM.
 
Old 08-04-2016, 09:02 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
What version of apache is it?

There are few reasons to edit httpd.conf.
This isn't one of them.

Last edited by Habitual; 08-04-2016 at 09:03 AM.
 
Old 08-04-2016, 09:18 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,633
Blog Entries: 4

Rep: Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931
Your question is not entirely clear . . .

If you want to resolve a domain-name (that is not known to the Internet at large), to an (internal) IP-address, then you must either be running a DNS = Domain-Name Server process on your network. Or, your Internet router might have this capability built-in.

The DNS, when given the question, "where is www.myserver.com?", sticks its hand up in the air (like the annoying know-it-all that is a fixture in every classroom) and says: "I know, teacher! I know! It's 10.10.10.10!"

So, your web-browser opens a connection to that IP-address on port #80 and sends the data. Included in the "HTTP headers" is, among other things, the actual target (www.myserver.com) that was requested.

When Apache (or nginix), sitting there listening to some IP-address such as 10.10.10.10, receives a new connection, it is able to determine from the HTTP headers what domain-name was used, or if an IP-address-only was used. It uses this information to attempt to locate a <VirtualHost> entry. (Or, it uses its default.) This is what determines how Apache first classifies the incoming request and then responds to it.

Last edited by sundialsvcs; 08-04-2016 at 09:23 AM.
 
Old 08-04-2016, 07:56 PM   #8
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
I used rinetd some years ago, and it's still available from fedora 23 repos. It's pretty old, and I don't know if it supports ipv6. It runs as a daemon and you edit a simple configuration file to set up all your redirects. It was useful and easy for ipv4 anyway.
 
Old 08-05-2016, 01:56 AM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Lightbulb

Quote:
Originally Posted by dushyantg View Post
Hi,

I have Apache and Tomcat Apache both are running on my server. I have also configured mod_jk connector.

I am able to access web apps of tomcat using Apache server but currenty i am accessing that like, 10.10.10.10/web now I want to redirect that to some domain like if I hit url like web.myserver.com will open 10.10.10.10/web. how can I do that?

Thanks.
You want to do it via internet or in your local network only?

If via internet you need to buy the domain, if only in your local network then you need to configure your DNS server and make an A or host record and point it to your server.

Check out this link for some basic DNS usage and terminology: https://support.dnsimple.com/article...ame-alias-url/

Good luck!!!
 
Old 08-05-2016, 04:54 AM   #10
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
What version of apache is it?

There are few reasons to edit httpd.conf.
This isn't one of them.
Server version: Apache/2.4.18 (Unix)
Cpanel::Easy::Apache v3.32.14 rev9999
 
Old 08-05-2016, 04:56 AM   #11
dushyantg
Member
 
Registered: Jun 2016
Posts: 70

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
You want to do it via internet or in your local network only?

If via internet you need to buy the domain, if only in your local network then you need to configure your DNS server and make an A or host record and point it to your server.

Check out this link for some basic DNS usage and terminology: https://support.dnsimple.com/article...ame-alias-url/

Good luck!!!
I am having a domain but A record of that domain is pointing to Ip of server as i said i want it to be pointed at serverip/webdirectory at this time i need to use like web.myserver.com/web instead of web.myserver.com
 
Old 08-07-2016, 04:45 AM   #12
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Red face

Quote:
Originally Posted by dushyantg View Post
I am having a domain but A record of that domain is pointing to Ip of server as i said i want it to be pointed at serverip/webdirectory at this time i need to use like web.myserver.com/web instead of web.myserver.com
You will need a 1 IP for: web.myserver.com/web and 1 IP for web.myserver.com

and of course you need to create an A record for each one of them.

Last edited by JJJCR; 08-07-2016 at 05:08 AM. Reason: edit
 
Old 08-07-2016, 11:43 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
@JJJCR
Quote:
You will need a 1 IP for: web.myserver.com/web and 1 IP for web.myserver.com

and of course you need to create an A record for each one of them.
This is wrong. An IP resolves to a hostname (e.g. web.myserver.com) and not a URL (e.g. web.myserver.com/web).
 
1 members found this post helpful.
Old 08-07-2016, 05:50 PM   #14
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Lightbulb

Quote:
Originally Posted by bathory View Post
@JJJCR

This is wrong. An IP resolves to a hostname (e.g. web.myserver.com) and not a URL (e.g. web.myserver.com/web).
Hi Bathory, okay thanks for the heads up.

But if the OP got a control on the DNS and sub-domain parking is allowed, I think he can do something like this web-web.myserver.com

Last edited by JJJCR; 08-07-2016 at 06:00 PM. Reason: edit
 
Old 08-07-2016, 05:55 PM   #15
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,148

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
check out this link: http://www.inmotionhosting.com/suppo...t-changing-url

Text below from above link:

Quote:
Example 1: Redirect and keep everything after the URL

The first option will show all of the same content on one URL as you would another. For example, if you just changed your domain to DomainB.com, but you still have plenty of visitors coming to DomainA.com, you would use this to show them all of the existing content that is located on the new domain, without the need to update both websites.

To do this, you would modify your .htaccess file for the domain that your users will go to, and insert these lines of code:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/$1 [P]

If you are using the file manager in cPanel, be sure that you have the option to show hidden files selected.

What does the above redirect do?
After adding this line into your .htaccess file, you will be able to go to DomainA.com/YourPage and it will show the content from DomainB.com/YourPage

Example 2: Redirect a domain to a specific url

There is another way you can do your redirect to show a specific URL, but keep the domain the same as well. If you want visitors to go to DomainA.com with a specific page in mind when doing so, you may use this code:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/PathToPageHere [P]

You would use this method if, for example, you had an external blog such as one on blogspot.com or maybe a shopping cart on etsy.com that you want people to visit your domain without fully hosting the domain there. Now, visitors can access your site using your domain, but see the content of an external URL.
Or check out this link: http://stackoverflow.com/questions/9...rl-with-a-path

Last edited by JJJCR; 08-07-2016 at 08:14 PM. Reason: edit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache URL redirection linux1986 Linux - Server 1 05-10-2012 07:15 AM
URL Rewriting without Redirection ganninu Linux - Server 2 04-29-2011 06:37 AM
URL Redirection in Apache harshaabba Linux - Software 1 02-21-2011 05:57 AM
Can I use squid for url redirection? GGlinux Linux - Software 2 02-24-2009 05:59 AM
mod_rewrite url redirection sqn Linux - Software 2 10-04-2006 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration