apachewebserverxamppvirtualhostdynamic-ip

Hosting a website on a PC using apache(Xampp)


This is what I learned by doing some searching. These things were taken from many places. Please point out any missing things. (I have not yet tried this out, just want to clarify what I'm going to do)

For hosting I need to have a static IP. But my ISP provide dynamic IPs. So I used DynDNS (as Cuga adviced in this). I belive this will resolve my dynamic IP problem by mapping the domain name I choose with my current(dynmically assigned) actual IP.

Next is setting up my Xampp server. For this I need my computer's local IP which I can get using ipconfig (or ipconfig/all for full details) in Windows command prompt (lets say local IP is 192.168.1.6).Now I have to edit httpd.conf located in xampp/apache/conf folder. "ServerName" field has to be changed to 192.168.1.6:80.

This should allow anyone using the hostname i got from DynDNS to access my computers xampp/htdocs folder. Please fill me in if there are missing parts.

Now I want to change the port that my clients can connet to my computer and the folder that I am going to host using it.

I know that I have to do protforwarding first and then configure apache to use that port instead of 80. Can someone explain me how to configure apache to use the new port.

And I want my clients who use my hostname I obtained from DynDNS, access some folder only that I specify (ex: xampp/htdocs/public) while I can access any file in xampp/htdocs using http://localhost/... . I think this what virtual hosts do. Can some one tell me how to do this.

Are there any solutions to the security issues that might arise and how to do this minimizing security issues?

Thank you.....


Solution

  • 1) if you specify ServerName as 192.168.1.6:80, only people who use this server name will be able to access your machine - those on the outside network will not.you should use *.80 2) to make apache listen on a different port, you need to add "Listen" directive to your httpd.conf. for example

    Listen 90
    

    and change ServerName accordingly 3) to let outsiders access only folders you want them to access, you can protect the rest with an .htpasswd. or you'll have to create a separate virtual host.