Recommended Posts

Hey

Im trying to get a web site hosted inside of my LAN so people can test it out. Its ran by Apache to be exact but I just cant seem to get it to work inside of my network. The only way I can get it to work is by editing the hosts file on each PC and pointing them at my IP resolving a FQDM (test.dev).

How can I do this? I have access to the router that forwards ports (although this may or may not have to do with anything)

Link to comment
https://www.neowin.net/forum/topic/1069600-interally-hosting-a-web-site/
Share on other sites

if you host a single site on that server by taping the ip (or name) they should open it. If not you need virtual hosts (define new site and enable it) and editing the host on each computer. Or you can setup apache to listen on another port for this site and do port forwading - like router ip:81 --> redirecting to server_ip:81 (or something)

you need virtual hosts (define new site and enable it) and editing the host on each computer

That is EXACTLY what I am currently doing and want to avoid it. I do not want to edit the host on each computer.

Going to the IP address of the site does not work, because it tries to go to "http://www.test.dev" which is not the site....

Well if you want the computers on your site to be able to resolve test.dev -- then setup local dns to do that! Editing the host file for every machine would not be the way to do it ;)

Going to www.test.dev when you go to http://ipaddress

Points to apache doing that on a redirect. You can clearly serve up a site off an IP quite easy with apache. When you say your going to the ipaddress of the site -- you do mean the private IP of the machine the apache is running on, and not your public IP correct?

Since its private, you could have apache listening on 100's of IPs to serve up 100's of different sites, etc. So you could get by without having to setup host headers/virtualhost/etc

Do you run Active Directory at this location? If so you already have DNS you could create a test.dev zone, etc.

Well if you want the computers on your site to be able to resolve test.dev -- then setup local dns to do that! Editing the host file for every machine would not be the way to do it ;)

Going to www.test.dev when you go to http://ipaddress

Points to apache doing that on a redirect. You can clearly serve up a site off an IP quite easy with apache. When you say your going to the ipaddress of the site -- you do mean the private IP of the machine the apache is running on, and not your public IP correct?

Yes. 192.168.100.73 which is my private IP of my PC on this LAN

Do you run Active Directory at this location? If so you already have DNS you could create a test.dev zone, etc.

No.

So your saying when you go to http://192.168.100.73 it redirects to http://www.test.dev

so what is in your host file on a machine that does this?

And what is your apache config look like? Do you have a .htaccess file with any sort of redirects in it?

so from a cmd prompt on a machine when you do

ping 192.168.100.73

What does the ping respond with, just the ip or does it return www.test.dev ?

If you want to setup DNS for your network - grab isc bind, runs on windows just fine. Or if you have a windows server OS, then you can install the dns role and create whatever zones and hosts you want. Or if you don't want to mess with full dns product like bind, you could grab tftpd32 which has a dns feature, that you could use to resolve test.dev, etc. etc.

http://tftpd32.jounin.net/

Tftpd32 is a free, opensource IPv6 ready application which includes DHCP, TFTP, DNS, SNTP and Syslog servers as well as a TFTP client.

So in your apache config, you sure you don't have something like this setup?

<VirtualHost *:80>

Redirect permanent / http://www.test.dev/

</VirtualHost>

So your saying when you go to http://192.168.100.73 it redirects to http://www.test.dev

so what is in your host file on a machine that does this?

Yes. If I put this in a hosts file on a machine

192.168.100.73 test.dev

It works. But I would have to go machine by machine...

so from a cmd prompt on a machine when you do

ping 192.168.100.73

What does the ping respond with, just the ip or does it return www.test.dev ?

If it is not in the hosts, it does not return test.dev

you could grab tftpd32 which has a dns feature, that you could use to resolve test.dev, etc. etc.

http://tftpd32.jounin.net/

Tftpd32 is a free, opensource IPv6 ready application which includes DHCP, TFTP, DNS, SNTP and Syslog servers as well as a TFTP client.

I thought about this as well but if I set this up wouldnt all other users on the network also have to point to me, a new DNS server? Kinda defeats the purpose....

So in your apache config, you sure you don't have something like this setup?

<VirtualHost *:80>

Redirect permanent / http://www.test.dev/

</VirtualHost>

I skipped over the first apache config question since you reasked it again in the same post. I have this setup in my httpd-vhosts.conf :

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "C:/test"

ServerName test.dev

ServerAlias test.dev

<Directory "C:/test">

Options Indexes FollowSymLinks Includes execCGI

AllowOverride All

Order Allow,Deny

Allow From All

</Directory>

ErrorLog "logs/test.dev-error.log"

CustomLog "logs/test.dev-access.log" combined

</VirtualHost>

"a new DNS server? Kinda defeats the purpose...."

NO not really -- if you not going to run dns, how do you expect users to resolve test.dev to your IP without a host file? If you current dns does not allow you to create Records to resolve, then your going to have to fire up one that does and use it. Or you going to have to use host files on each machine, or you going to have to use IP address directly.. How else do you think you can resolve a fqdn??

DNS can be handed via dhcp, so you don't have to touch any box to get them to point to your dns.

You clearly have done something either with the site or apache itself to change the to www.test.dev when you access http://ipaddress

Here I just fired up apache on my test linux box. apt-get install apache2

And there you go access of site via IP with no redirects.. So either you messed with the config of apache, edited the .htaccess file or the page your loading from the site is doing the redirect.

What is the source of the site your serving up have in its headers? Are you doing something like

&lt;meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"&gt;

post-14624-0-58885600-1334160548.jpg

I even added your ServerName and ServerAlias tags -- those have nothing to do with redirection

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot /var/www

ServerName test.dev

ServerAlias test.dev

"a new DNS server? Kinda defeats the purpose...."

NO not really -- if you not going to run dns, how do you expect users to resolve test.dev to your IP without a host file? If you current dns does not allow you to create Records to resolve, then your going to have to fire up one that does and use it. Or you going to have to use host files on each machine, or you going to have to use IP address directly.. How else do you think you can resolve a fqdn??

Internally, I dont care if they resolve test.dev or not. I want the internal site to work.

You may have not read correct but if they go to

http://192.168.100.73

they cannot see the site either. And yes, they can ping me.

The only way they can see my site is by editing their host file and putting

192.168.100.73 test.dev

then they can access http://192.168.100.73 AND http://test.dev

You clearly have done something either with the site or apache itself to change the to www.test.dev when you access http://ipaddress

Well, not sure what files to look at although Im almost certain Ive only touched that one. This is a Magento site if it makes any difference.

What is the source of the site your serving up have in its headers? Are you doing something like

&lt;meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"&gt;

Havent done this either.

So you setup this package http://www.magentocommerce.com/

Look at the index.html file or index.php file, etc. in you c:/test folder-- many of these canned sites have redirects built into them.. So yeah you hit http://ipaddress and right away your redirected to http://www.test.dev which no is not going to work, so nothing is going to be shown in the browser.

I have not used this application so would have to install it to see what it does out of the box.

edit: Ok just hit up a demo admin page, and yeah this could be an issue

post-14624-0-70314700-1334162753_thumb.j

It defaults to redirect vs no, and then there is also a setting in here that redirects to base url if cookies disabled, etc..

So your redirect is to www.test.dev that could be your problem right there, if the client can not resolve that.

So you need to either disable this redirection stuff, change it to IP address. Or use your host file, or setup dns.

Here is installation manual:

http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/magento_installation_guide

You could try to run it on wamp server for windows or you could configure some Linux to serve it (it is required, based on manual). It seems to me like normal installation, make database in phpmysql, unzip archive in web folder and go to http://192.168.100.73/folder_where_are_magento_files.

Also, pay attention to this:

During the installation process Magento will set cookies and most browsers will refuse to accept cookies for localhost. This can lead to several problems but no error messages. E.g. when trying to set the locale the page will just refresh and revert to the standard En-US locale..

To avoid this problem, you can set up Magento to use 127.0.0.1 as its domain name or create another entry for localhost in your computer?s /etc/hosts file and use that hostname to access the site, as shown below:

There was something in there that stated if cookies not working, redirect to base url. So yeah if trying to set cookie for localhost, which browser refuses -- if your base url is www.test.dev then sure would explain what is happening.

Per your other thread seems like this site will be hosted elsewhere, this seems like a good idea to me ;)

There was something in there that stated if cookies not working, redirect to base url. So yeah if trying to set cookie for localhost, which browser refuses -- if your base url is www.test.dev then sure would explain what is happening.

But technically since they are other IPs, they arent localhosts.......

Per your other thread seems like this site will be hosted elsewhere, this seems like a good idea to me ;)

It will :) This was just for some internal testing.

Hosting it somewhere else is another complete challenge which I have never in my life done...

"But technically since they are other IPs, they arent localhosts......."

Which has nothing to do with the name on the cookie that application might set.

Fix up your redirect stuff in the admin page of that web app and you should be able to use http://ipaddress vs host name, etc. Which should remove your need for host file entries or dns.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Just for anyone reading, AdGuard (the free, standalone MV3 extension) is quite good now, a direct competitor to uBlock Origin Lite and much more built-out than it.
    • Microsoft Edge 149.0.4022.62 by Razvan Serea Microsoft Edge is a super fast and secure web browser from Microsoft. It works on almost any device, including PCs, iPhones and Androids. It keeps you safe online, protects your privacy, and lets you browse the web quickly. You can even use it on all your devices and keep your browsing history and favorites synced up. Built on the same technology as Chrome, Microsoft Edge has additional built-in features like Startup boost and Sleeping tabs, which boost your browsing experience with world class performance and speed that are optimized to work best with Windows. Microsoft Edge security and privacy features such as Microsoft Defender SmartScreen, Password Monitor, InPrivate search, and Kids Mode help keep you and your loved ones protected and secure online. Microsoft Edge has features to keep both you and your family protected. Enable content filters and access activity reports with your Microsoft Family Safety account and experience a kid-friendly web with Kids Mode. The new Microsoft Edge is now compatible with your favorite extensions, so it’s easy to personalize your browsing experience. Download: Microsoft Edge (64-bit) | 193.0 MB (Freeware) Download: Microsoft Edge (32-bit) | 170.0 MB Download: Microsoft Edge (ARM64) | 188.0 MB View: Microsoft Edge Website | Release History Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Yeah, when I saw that, I wanted to find the nearest nose. You can't find a good nose these days when you need one.
    • Anthropic launches Claude Fable 5, a state-of-the-art AI model that beats OpenAI's GPT-5.5 by Pradeep Viswanathan Back in April, Anthropic announced Claude Mythos Preview, a frontier model with state-of-the-art coding capabilities. Due to the cybersecurity implications that would occur due to the availability of such a powerful model, Anthropic made it available to only a select set of companies around the world. The company's plan was to prepare appropriate guardrails before releasing such a powerful model to everyone. Now, after nearly two months, Anthropic announced Claude Fable 5, its most capable AI model yet for general users. The company also announced Claude Mythos 5, the same underlying model as Fable 5, but with safeguards lifted, making it more suitable for selected cybersecurity and biology use cases. Claude Fable 5 sits a tier above its Opus models and it beats most other generally available models across areas including software engineering, knowledge work, vision, scientific research, and long-running autonomous tasks. To prevent model misuse, when Claude Fable 5 detects certain requests related to cybersecurity, biology, chemistry, or model distillation, the request will be routed to the Claude Opus 4.8 model. Anthropic claims that these safeguards trigger in less than 5% of sessions on average. However, for large organizations working on critical software, Claude Mythos 5 can be availed through Project Glasswing. Later, Anthropic has plans to expand access through a broader trusted access program. As you can notice in the benchmarks above, Fable 5 and Mythos 5 are state-of-the-art on most key AI benchmarks and they are well ahead of OpenAI's frontier model, GPT-5.5. For example, Fable 5 is the new state-of-the-art model for vision tasks. Also, Mythos 5 has the strongest cybersecurity capabilities of any model in the world. Claude Fable 5 and Claude Mythos 5 are priced at $10 per million input tokens and $50 per million output tokens, which is less than half the price of Claude Mythos Preview. Another big change is that Anthropic is making a change to the way they handle business customer data for both Fable 5 and Mythos 5 models. The company will now require 30-day retention for all traffic on both first- and third-party surfaces. Anthropic promises that it won't use the data to train Claude models, instead it will use it against complex and novel attacks. Claude Fable 5 is available today on the Claude API and consumption-based Enterprise plans. It is also included at no extra cost for Pro, Max, Team, and seat-based Enterprise customers from today through June 22. After that, users on those plans will need usage credits to continue using Fable 5, unless Anthropic extends the included access window based on capacity. Developers can access Fable 5 through the Claude API using the claude-fable-5 model name.
  • Recent Achievements

    • Week One Done
      rubentuben8 earned a badge
      Week One Done
    • Week One Done
      ARaclen earned a badge
      Week One Done
    • One Year In
      jojodbn earned a badge
      One Year In
    • One Month Later
      jojodbn earned a badge
      One Month Later
    • Week One Done
      jojodbn earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      530
    2. 2
      PsYcHoKiLLa
      234
    3. 3
      +Edouard
      128
    4. 4
      ATLien_0
      88
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!