0

I got 2 sites configured via apache vhost like:

<VirtualHost *:443>
    DocumentRoot /var/www/site1
    ServerName  www.site1.com
...
    
<VirtualHost *:443>
    DocumentRoot /var/www/site2
    ServerName  www.site2.com
...

I would like to know how to make a request to those sites locally from the server that is running apache. I can connect to the server via SSH and then I would like to do for example wget. When I use for example www.site1.com domain as a request then it goes outside to the Internet and then it comes back to the server. I would like to check the site just locally without the request going outside the server. I guess I can use local IP address to get the response from the first site, but I do not know how to access the other one.

1

If Apache is listing on all interfaces (which it is by default), you can just add the host names to /etc/hosts file and access them via the loop back interface.

#/etc/hosts
...

127.0.0.1 www.site1.com www.site2.com

...

Then try from the server terminal to access is via wget or curl

$ curl -Iv https://www.site1.com
1

You can edit /etc/hosts or you should use curl with option resolve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.