Forum

Thread tagged as: Question, Configuration, Hosting

Accessing locally hosted development site from external computer

I followed all the really helpful instructions in the docs about installing Xampp and how to configure localhost etc:

https://docs.grabaperch.com/perch/building/servers/installing-a-local-server-with-xampp/

And my development site has been working really well with both myself and my content editor accessing the site while within the home/office network. However, now we are at a stage where we would like to allow a few users externally to access the site to test and evaluate. I have set up the router to port forward on port 80. This is working but I can only actually access the Xampp dashboard when I enter my.external.ip.address:80 into a browser.

The folder holding all of my website and perch folders on my local computer is not the Xampp/htdocs folder. I followed your instructions to change the host file and httpd-vhosts file to configure the local host and route to mysite.local.

However when I try typing my.external.ip.address/mysite.local into an external computer, it gives me a 404 error.

So my question in summary, is, how do I get from the Xampp dashboard to my locally hosted site?

Hope someone can help. Thanks

Andrew Auld

Andrew Auld 0 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

This is the sort of question that would be better posted in the Xampp forums. It's not specific to Perch so you will get better replies there.

Hi Andrew

FWIW, you'd be much better off copying the site to a staging setup on dedicated web hosting, preferably the same hosting as the final production server so you can pick up any hosting quirks before going live. Trying to get this working locally is just not worth the effort.

Kind regards

Jon

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Andrew,

If you use virtual hosts and access your XAMPP "server" from an external device with an IP address, I think it directs you to the virtual host with ServerName localhost by default.

With a basic XAMPP setup you can only access one site at a time from an external device and you will have to keep changing the DocumentRoot and Directory (you have to restart Apache every time you change them.)

<VirtualHost *>
  DocumentRoot "C:/sites/example.com"
  ServerName localhost
  <Directory "C:/sites/example.com">
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

Trying to get this working locally is just not worth the effort.

I don't think this is entirely true. It is nice to be able to test on different devices locally before pushing things to staging. It depends on what you are working on.

For example, actual mobile browsers may have different behaviour to desktop. Yes you can test for different viewports using your desktop browser dev tools, but that's not all you need to test for.

Off the top of my head:

  • Chrome dev tools autoplay videos even if you use the dev tools to test on "iPhone X" which may not happen on a real iPhone X.
  • Samsung Mobile, for example, has 2 toolbars. The address bar on top and another toolbar at the bottom. When you scroll they disappear. When they disappear the calculated value 100vh changes.

I don't think it would be a nice workflow to have to update staging just to see whether a small change fixed a bug or solved a layout issue on mobile for example. And then you may find out you had a typo, edit and update staging again and so on. So in some cases, I think it is worth the effort.

Hi Hussein

I agree that testing on devices locally via a network is great - it's how I work too. But (correct me if wrong) I think Andrew's talking about people accessing the site from outside the internal network. I still think this is a bad idea.

Rachel Andrew said:

This is the sort of question that would be better posted in the Xampp forums. It's not specific to Perch so you will get better replies there.

Fair point, but given that your guide had included some information about the configuration of Xampp to use virtual ports and not to use the htdocs folder in Xampp, I thought you might have a quick and ready answer.

So far my searching on Xampp forum for the answer (which I had looked in before posting here in fact) has resulted in the recommendation that the local website should have been in the htdocs folder to start with, either at it's root or in a sub-folder. I tried moving my local files to a subfolder within htdocs and updated the virtualserver config to point at this location but it messed up the perch installation because of the way perch puts links into the database. I have read other posts in this forum about pros and cons of using sub folders for development and I am now pretty nervous about how it is going to go when I try to move to my online.

Hey ho, we will see.

Jonathan Elliman said:

you'd be much better off copying the site to a staging setup on dedicated web hosting, preferably the same hosting as the final production server so you can pick up any hosting quirks before going live

I am looking in to how to do this with my hosting provider. I am new to this sort of structured workflow in my web development. Lots still to learn.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

But (correct me if wrong) I think Andrew's talking about people accessing the site from outside the internal network. I still think this is a bad idea.

Oh I must have misunderstood his question ^^!

Jonathan Elliman said:

I think Andrew's talking about people accessing the site from outside the internal network

Correct.

And I have heard the message that it is a bad idea!!

Now wrestling with how to get a staging environment set up with my web host which will have the equivalent 'root - folder' relationship that my live site will have.

I'll get there and thanks to people for their advice. It is all very helpful.