Mobile app version of vmapp.org
Login or Join
Murphy175

: Configure apache to make local website available for external people I would like to make my local website (running on a virtual CentOs machine) accessible for my mate who is also working on

@Murphy175

Posted in: #Apache2

I would like to make my local website (running on a virtual CentOs machine) accessible for my mate who is also working on the website.
I have created a new line in my router config to forward all requests on port 8080 to my centos machine.
I've setup apache to listen on port 8080 as my ISP blocks port 80.
I've setup my VHosts to use port 8080.
When my mate now tries to go to my_external_ip:8080, he can see my apache welcome page.
I've asked him to enter this in his hosts file.
my_external_ip my_local_domain_name.com
When he types that url into his browser, the site doesn't load.
What could this be?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Murphy175

3 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

I have an apache2 server configured on a local server with a private IP. My linksys routes http, mysql, ssh, and ftp to that private IP. I think it's under Applications or Forwarding in the linksys dashboard. I then use Amazon route 53 with an A record to my External IP. So anyone connecting to example.com is routed to my IP, reaches my linksys and that routes the connections to my local apache2 server.

10% popularity Vote Up Vote Down


 

@Yeniel560

I think the problem is in your Apache configuration, and perhaps with the IP addresses you are using with Apache.

Check the IP address that CentOs is really using. You probably have a public IP address that your ISP assigns to you, but your CentOs VM is certainly running on a local IP address like 192.168.1.10 (for example). This is the IP address Apache must listen to, not your public IP.

You can run ifconfig in console to see what IP the VM is using. Make sure you have set up CentOs to use a static IP (not DHCP) or you might be using a different local IP every time you restart your machine.

Open /etc/httpd/conf/httpd.conf. If you want Apache to reposnd to port 8080, make sure you have a line like this before all the Virtual Host stuff (assuming 192.168.1.10 as the static IP of CentOs):

Listen 192.168.1.10:8080


Then set Apache to run virtual hosts on this IP:

<VirtualHost 192.168.1.10:8080>
ServerName mydomain.local ServerAlias mydomain.local #or whatever
...
</VirtualHost>


You may want to also put this in your own /etc/hosts file as well:

192.168.1.10 mydomain.local

Then you can access the same domain name locally.

10% popularity Vote Up Vote Down


 

@Dunderdale272

In your apache virtual host configuration (where you specified that is should listen on port 8080), be sure to add mydomain.local (or whatever you use) as a ServerAlias.

Simply just add a line below the initial <virtualHost *:8080> tag, saying:

ServerAlias mydomain.local

Update: Your mate also needs to be able to resolve mydomain.local to the actual IP address

He'll need to add a line to his /etc/hosts file (if he is also running CentOS/Debian/Linux), if he's running windows, add it to C:Windowssystem32driversetchosts

If your external IP is 199.199.199.199, his entry should look like this:

199.199.199.199 mydomain.local

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme