How to use proper DIR and Virtual Hosts


  • | 780 points

    Hi,

    I'm very new at this, I'm sorry about the really newbie questions!

    I installed Wordpress with Laragon, and Laragon document root is set to \www, I pull up the computer's IP address, and all I see is the Laragon getting started page. If I set the document root to \www\testwebpage, it will show my Wordpress site. Is this how it's supposed to work? How am I supposed to get it to read my webpage without changing the document root?

    Second, I would like to use a virtual host. So I create a second Wordpress site, let's say \www\testwebpage2, how do I get Laragon to create the virtual host? I'm using a free DNS service that's pointing with CNAME to a dynamic DNS that's on the computer with the 2 websites. I would like it to work like:
    testwebpage.freedns.com->test.dyndns.com->\www\testwebpage
    testwebpage2.freedns.com->test.dyndns.com->\www\testwebpage2
    Possible?


  • administrators
    | 97034 points

    @MrSumOne : Laragon auto creates Virtual Host for you. You don't need to change Laragon Document Root.
    If you use \www as Document Root, and you can access your testwebpage with this link:
    http://testwebpage.test

    Ref: https://laragon.org/docs/pretty-urls.html


  • | 780 points

    @leokhoa Yes, but then I can't access it anywhere but locally. How am I supposed to push it out so that I can view it on other computers by typing the IP address?


  • administrators
    | 97034 points

    @MrSumOne : The easiest way is using Quick share:
    https://laragon.org/docs/quick-share.html


  • | 780 points

    @leokhoa Thanks so much for answering my questions! I came up with a few more that I have in response to your answer.

    I set the document root to \www, then used ngrok to share testwebpage, the url generated leads me to the Laragon getting started page! Things will only work properly when I set the document root to \www\testwebpage, what am I doing wrong?

    Also, with the setup I have of freedns->ddyns->computer ip, I was able to access certain programs remotely by typing testwebpage.freedns.com:1234, the program being on port 1234. When I use ngrok, I can no longer do this, so it might be that I'm using the wrong tool when I'm using Laragon. Should I be using a simple WAMP instead?

    Finally, ngrok seems to have an expiry time on the session... what if I want my page to stay up longer than the 8 hours it starts counting down?

    Again, sorry about the newbie questions, I'm learning a lot.


  • | 780 points

    Hey, I don't want to post a new thread, I thought I would just bump this one, since I didn't get an answer to my latest question. If anyone can help, it would be greatly appreciated.


  • administrators
    | 97034 points

    @MrSumOne :

    I set the document root to \www, then used ngrok to share testwebpage, the url generated leads me to the Laragon getting started page! Things will only work properly when I set the document root to \www\testwebpage, what am I doing wrong?

    You don't need to change Document Root to make ngrok work. Can you rename your C:\laragon to C:\laragon.bak and install a clean Laragon to C:\laragon to try again?


  • | 780 points

    @leokhoa So I reinstalled, and when I share with ngrok and go to the site address it gives me it works. Now when I use my free DNS service to go to those addresses via CNAME, my first test site goes to the Laragon getting started page, and my second test site goes to a site that says "Tunnel test2.freedns.com not found".

    I also still have my original questions about ngok and if it's suited for what I'm trying to do. As per my previous post:

    Also, with the setup I have of freedns->ddyns->computer ip, I was able to access certain programs remotely by typing testwebpage.freedns.com:1234, the program being on port 1234. When I use ngrok, I can no longer do this, so it might be that I'm using the wrong tool when I'm using Laragon. Should I be using a simple WAMP instead?

    Finally, ngrok seems to have an expiry time on the session... what if I want my page to stay up longer than the 8 hours it starts counting down?


  • administrators
    | 97034 points

    @MrSumOne : I see why you don't need ngrok. In your case, you need to add testwebpage.freedns.com to Laragon's virtual host file in Menu > Apache > sites-enabled


  • | 780 points

    @leokhoa That is exactly what I was looking for, everything is working perfectly. Thanks!


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.