How to make localhost


networking and localhost setup – xampp-appache-httpd-vhosts
I have been searching google for over an hour and a half… could not find the total result i was searching for… one of the forums google sent me too had an admin guru tell me to google what i wanted and not be spoon fed…. was curious why he chose to offer help on forums if his generic answer is ‘what did google say’ and then to only find out that their web site gets high rank on google… and they say google isnt biased😯

anyways, the issue v solution:

i have installed xampp on on one pc on my home network… all set up and working great… enter pc#2 on the network, i wished to have no restrictions on which pc i needed to be on to access both xampp docs, and the sites themselves.

The Docs:
Is a simple matter of making that hard drive, or specific folder structure available across your network. XP navigatte to your folder or HDD.
‘My Computer>right click the HDD or if its a folder on the HDD, navigate the HDD untill you come to the folder you want shared and right click it, select ‘sharing and security’ then click ‘if you understand the risk but still want…. blahh blahh’ then select the check box ‘share this folder on the network’ & ‘allow network users to change my files’. – Apply

you can now access all your sites from any pc on the network and edit as you wish…

The Sites:
This part wont take too long, but if you have manyyyy pc’s you want to have this option… ask google if there is an easier way, otherwise, the following will work, but is gonna take you a while❗
Part1 – xampp apache setting
lets start with the PC xampp is installed on,
Open ‘C:\xampp\apache\conf\extra\httpd-vhosts.conf’
if you have already altered this file, then make the adjustments for IP only.
chances are it looks like this
Code:
NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
DocumentRoot D:/xampp/htdocs/
ServerName localhost
</VirtualHost>

i changed mine like this
Code:
NameVirtualHost 127.0.0.1:80
NameVirtualHost 192.168.1.18:80

<VirtualHost xxx.localhost>
DocumentRoot C:/xampp/htdocs/
ServerName xxx.localhost
</VirtualHost>

2nd namevirtualhost is the network IP of the xampp pc.

next i have the site settings, use the relative paths for your sites location
Code:
<VirtualHost xxx.ozestretch.com>
DocumentRoot “C:/WWW/Mine/yoursite/site/public-html”
ServerName xxx.yoursite.com

CustomLog “C:/WWW/Mine/yoursite/site/logs/access.log” combined
ErrorLog “C:/WWW/Mine/yoursite/site/logs/error.log”

<Directory “C:/WWW/Mine/yoursite/site/public-html”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost xxx.site2.com>
DocumentRoot “C:/WWW/Mine/site2/site/public-html”
ServerName xxx.site2.com

CustomLog “C:/WWW/Mine/site2/local-logs/access.log” combined
ErrorLog “C:/WWW/Mine/site2/local-logs/error.log”

<Directory “C:/WWW/Mine/site2/site/public-html”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

you may have many more of these, i just use the 2 for the example.

Part2 – win hosts setting
staying with the xampp pc for now,
Open ‘C:\WINDOWS\system32\drivers\etc\hosts’ – use notepad/wordpad
you will probably have something like
Code:
#127.0.0.1   localhost

edit for:
Code:
127.0.0.1   localhost xxx.localhost
192.168.1.18   xxx.localhost

127.0.0.1   xxx.yoursite.com
127.0.0.1   xxx.site2.com
192.168.1.18   xxx.yoursite.com
192.168.1.18   xxx.site2.com

remember the 192.168.1.18 i used, should be the network IP of your xampp pc

ok, now stand up and stretch your legs as you make your way to the 2nd pc…
Open ‘C:\WINDOWS\system32\drivers\etc\hosts’ – use notepad/wordpad
you will probably have something like
Code:
#127.0.0.1   localhost

edit for:
Code:
192.168.1.18   xxx.localhost

192.168.1.18   xxx.yoursite.com
192.168.1.18   xxx.site2.com

remember the 192.168.1.18 i used, should be the network IP of your xampp pc

if you have more machines, then go do the last step on them too.

to access xampp from the non xampp machine
http://xxx.localhost – can be same url for the xampp machine, but http://localhost will work on the xampp machine also.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: