Yasir Rashid
Yasir Rashid

Reputation: 11

how to access xampp virtual host on mobile

as i am a new in developing,,therefore i want to know that how can a i access virtual host of xampp while i have accessed xampp localhost on my mobile deveice(I-phone)..And I have created virtual host in

C:\xampp\apache\conf\extra/httpd-vhosts.conf file as follow:

<VirtualHost yasir.com:80>
  ServerAdmin [email protected]
  DocumentRoot "C:/xampp/htdocs/yasir"
  ServerName yasir.com
  ServerAlias www.yasir.com
  ErrorLog "logs/yasir.com-error_log"
  CustomLog "logs/yasir.com-error_log" combined
</VirtualHost>

and also added the line

127.0.0.1    yasir.com

in

C:\Windows\System32\drivers\etc\hosts

Upvotes: 0

Views: 1825

Answers (1)

thexacre
thexacre

Reputation: 692

I suspect you'll find ngrok to be the easiest solution.

Modifying your local host file will only affect that single PC, you would need to also modify the host file on your mobile (which may not be possible) and specify the external IP of your PC rather than 127.0.0.1 for what you've described to work.

Change <VirtualHost yasir.com:80> back to <VirtualHost *:80> first though and specify your ngrok domain as a ServerAlias.

Upvotes: 3

Related Questions