LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DNS settings on a local network (https://www.linuxquestions.org/questions/linux-networking-3/dns-settings-on-a-local-network-850084/)

JJJCR 12-14-2010 01:32 AM

DNS settings on a local network
 
hi guys, how to resolve an ip with a port in linux?
i mean like this:

http://192.168.1.10:8000, how to include this on the dns. So the user don't have to remember the ip address and the port.

like the user will only type http://scanfiles then it will resolve the corresponding ip. is it possible?

Thanks.

Angel2953 12-14-2010 02:32 AM

.htaccess, mod_http_proxy and mod_rewrite with apache:
Code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^scanfiles$
RewriteRule ^(.*)$ "http\:\/\/192\.168\.1\.10\:8000%{REQUEST_URI}" [P,QSA,L]


JJJCR 12-16-2010 07:54 PM

Quote:

Originally Posted by Angel2953 (Post 4190706)
.htaccess, mod_http_proxy and mod_rewrite with apache:
Code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^scanfiles$
RewriteRule ^(.*)$ "http\:\/\/192\.168\.1\.10\:8000%{REQUEST_URI}" [P,QSA,L]


Hi Angel, sorry quite new with apache so i had to edit those files .htaccess, mod_http_proxy and mod_rewrite and place those codes? thanks.

acid_kewpie 12-17-2010 02:16 AM

Quote:

Originally Posted by JJJCR (Post 4194193)
Hi Angel, sorry quite new with apache so i had to edit those files .htaccess, mod_http_proxy and mod_rewrite and place those codes? thanks.

No, you'd create a .htaccess file in the right location and use the modules by virtue of the directives listed. My personal preference would be to put any config in your httpd.conf directly, not in an .htaccess file.

Another approach could be to use mod_proxy:

ProxyPass / http://127.0.0.1:8080

within the virtualhost for the "scanfiles" website. That way you don't redirect the client at all, and you always have the nice looking url.

Note that the solution given here does NOT answer your question, as your question is an invalid one. DNS names have nothing whatsoever to do with ports, it doesn't make sense to resolve something to a port, so you'd do it in a different way.


All times are GMT -5. The time now is 02:48 PM.