Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accessing a local virtual host from outside LAN as virtual host like http://sitename instead of http://systemname/sitename

I am developing a site and that that is managed by two. one is me and the other is the designer accessing from different machines across LAN.

Conf: php, apache, windows xp, mysql.

Document root: d:\www\xampp\htdocs. all the projects are under this as subfolders.

I have set up virtual host so that i will not access all the projects as http://localhost/foldername but just as http://foldername.

But for the designer who is in the other system he has to access like http://computername/foldername

For example let me be working in a project payroll. i will access that as http://payroll but my designer will access that as http://computername/payroll.

What i want to do is i want the designer to access the same way i access. that is http://payroll.

so that in the designer system when the server name is payroll i want it to be directed to my machine and then to the project folder. so if he gives http://payroll then the application in my system should run for him.

i have setup the hosts file in the designer system to point to my machine. so this work is done and when he gives payroll my http://localhost is appearing.

what should i do so the designer can access my project like http://payroll form his system?

like image 851
Jayapal Chandran Avatar asked Nov 03 '10 06:11

Jayapal Chandran


People also ask

What is the difference between localhost and virtual host?

Localhost: “Localhost refers to the local computer that a program is running on”. Webhosting: “In order to publish a website online, you need a Web host. The Web host stores all the pages of your website and makes them available to computers connected to the Internet”.

Where is httpd conf virtual host?

Virtual host configuration is typically placed within the /etc/httpd/conf/httpd. conf file, and also in unique . conf files within the /etc/httpd/conf. d directory.


1 Answers

The designer has to add your IP address with each sitename to his hosts file as without it his browser won't know where to look for the site. It could look like this:

12.34.56.78 sitename1
12.34.56.78 sitename2
12.34.56.78 repeat.for.each.sitename
...

This might be enough if your VirtualHosts are not bound to a specific IP address. This would not work:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
    ServerName sitename1
    ...
</VirtualHost>

It should be:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName sitename1
    ...
</VirtualHost>

This way apache will serve the site called sitename whenever it sees a request with the hostname sitename and it won't matter if it came from the same computer or not.

like image 128
Tomas Markauskas Avatar answered Oct 19 '22 02:10

Tomas Markauskas