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

    • I do trust Apple probably more than these other companies with certain data, but I also do think (and it has been demonstrated that) Apple pulls a lot of shenanigans and always has for a long time.
    • Does your iPhone support the latest iOS version? Here's the iOS 27 compatibility list by Aditya Tiwari It's that time of year when we get to know about the latest operating system updates for Apple devices. For iPhone, Apple previewed the iOS 27 update at WWDC 2026, where the company finally introduced an upgraded version of Siri. Apple typically supports iPhone models for up to five years. But it has been making exceptions in recent years (read iPhone 11). If you're wondering whether your iPhone is compatible with the iOS 27 update, here is the official list of devices: iPhone 17 Pro Max, iPhone 17 Pro, iPhone 17, iPhone 17e, iPhone Air iPhone 16 Pro Max, iPhone 16 Pro, iPhone 16, iPhone 16 Plus, iPhone 16e iPhone 15 Pro Max, iPhone 15 Pro, iPhone 15 Plus, iPhone 15 iPhone 14 Pro Max, iPhone 14 Pro, iPhone 14 Plus, iPhone 14 iPhone 13 Pro Max, iPhone 13 Pro, iPhone 13, iPhone 13 mini iPhone 12 Pro Max, iPhone 12 Pro, iPhone 12, iPhone 12 mini iPhone 11 Pro Max, iPhone 11 Pro, iPhone 11 iPhone SE (2nd generation), iPhone SE (3rd generation) So, you can download the iOS 27 developer beta on up to 31 different iPhone models. There has been no change to the list of supported iPhones since iOS 26. However, it will expand to include more devices when the iPhone 18 series arrives later this year. To download the developer beta on your iPhone, go to Settings > General > Software Update > Beta Updates. Here, select "iOS 27 Developer Beta" from the list of choices to get the new update. In addition to iOS 27, you can try the developer beta versions of macOS 27, iPadOS 27, watchOS 27, tvOS 27, and HomePod software 27 on your supported devices. iOS 27 comes with improved Liquid Glass, which you can adjust using a new transparency slider. Apple said during the keynote that iPhone apps now launch up to 30% faster, new photos appear in the Photos app up to 70% faster, and AirDrop transfers work up to 80% faster. The new update promises to improve performance on older iPhones by introducing a new CPU Scheduler that supports devices all the way back to the iPhone 11. While iOS 27 is supported on older iPhones, it goes without saying that they'll lack several features due to hardware differences. For instance, iPhone 14/14 Plus and older models come with a notch instead of the Dynamic Island. Similarly, Apple Intelligence features are supported on iPhone 15 Pro/Pro Max and later models.
    • The Radeon RX 9070 XT is right up there with the GeForce RTX 5070 Ti
    • I don't know why someone said useless, but it does have that pesky kernel driver bundled, and it's in perennial turmoil. When it goes bad, it goes very bad, and it's impossible to predict when it will due to system differences. I know that they're in the middle of development for a major new version that will include a completely new driver, one that they expect will largely solve the problem, but that's a ways out and it's unproven at this point.
    • doesn't AdGuard let ads through that pay to be let through?
  • Recent Achievements

    • Experienced
      JayZJay went up a rank
      Experienced
    • Reacting Well
      Sir_Timbit earned a badge
      Reacting Well
    • Week One Done
      rubentuben8 earned a badge
      Week One Done
    • Week One Done
      ARaclen earned a badge
      Week One Done
    • Week One Done
      jojodbn earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      524
    2. 2
      PsYcHoKiLLa
      232
    3. 3
      +Edouard
      132
    4. 4
      ATLien_0
      88
    5. 5
      Steven P.
      83
  • Tell a friend

    Love Neowin? Tell a friend!