: 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
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?
More posts by @Murphy175
3 Comments
Sorted by latest first Latest Oldest Best
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.
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.
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.