LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   IP to URL redirection (https://www.linuxquestions.org/questions/linux-server-73/ip-to-url-redirection-4175586143/)

dushyantg 08-03-2016 12:32 AM

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.

TB0ne 08-03-2016 07:50 AM

Quote:

Originally Posted by dushyantg (Post 5585047)
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/

dushyantg 08-04-2016 01:16 AM

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.

dushyantg 08-04-2016 04:01 AM

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

dushyantg 08-04-2016 05:09 AM

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

Habitual 08-04-2016 09:02 AM

What version of apache is it?

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

sundialsvcs 08-04-2016 09:18 AM

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.

Doug G 08-04-2016 07:56 PM

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.

JJJCR 08-05-2016 01:56 AM

Quote:

Originally Posted by dushyantg (Post 5585047)
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!!!

dushyantg 08-05-2016 04:54 AM

Quote:

Originally Posted by Habitual (Post 5585866)
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

dushyantg 08-05-2016 04:56 AM

Quote:

Originally Posted by JJJCR (Post 5586305)
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

JJJCR 08-07-2016 04:45 AM

Quote:

Originally Posted by dushyantg (Post 5586353)
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.

bathory 08-07-2016 11:43 AM

@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).

JJJCR 08-07-2016 05:50 PM

Quote:

Originally Posted by bathory (Post 5587416)
@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

JJJCR 08-07-2016 05:55 PM

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


All times are GMT -5. The time now is 06:51 PM.