Port Forwarding in apache - apache

My web server is resolved from other users outside my internal network. The issue is that it redirects me to the router page on my PC. Anyway to fix this, I have to use a proxy to see my own web server, and it can be dangerous to my privacy and code.
Is there a fix for this?

There is not a fix because that is done for security by your router and since the request is coming back to your router from your ip it will think you are trying to go to your router page so to be able to see the site just follow the following steps:
Go to "C:\Windows\System32\Drivers\Etc" and MOVE the "HOSTS" file to your desktop.
Open it up and follow the steps below but in this example STACKOVERFLOW.COM will be the URL and the local server ip is 192.168.1.255:
# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
192.168.1.255 stackoverflow.com
192.168.1.255 siteb.com
192.168.1.255 sitec.net
Copy all the code above the UNDERSCORE but DONT COPY THE UNDERSCORE.Paste it into your hosts file and change it aroud to suite your needs. Change the ip to your servers local ip and your url to the url u use to connect to the site with. Just make sure you SAVE THE FILE AND MOVE IT BACK TO YOUR ETC FOLDER!

Related

Cant access my website through its IP address

I have hosting with godaddy with a private IP address. I am able to access my websites and others via the domain name, but not via IP Address.
I am now trying to access the HTTP via port 80 but it gives an error that the website is not setup.
Are there any workarounds on turning allowing accessing the website and other folders through the IP address over http?
This sounds to me like you were on a managed webpack that grants you access to the to-be-served content but not to the webserver or its config itself.
What you are experiencing there is an effect of a technique called virtual-hosts in which multiple sites are tied to one IP address. For this to work in the realm of HTTP, the Host header got introduced in HTTP/1.1. It allows clients to send a domain name for which they want to receive content.
If you request a raw IP, though, the Host header won't look like Host: example.com but rather like Host: 123.45.67.89. The server will not be able to associate a domainname with this as it is unlikely to be found elsewhere in the request. Therefore, it will be forced to serve content out of its default document directory which usually contains further documentations regarding the further configuration of the webserver in question. Linux distributions like to add additional informations specific to them. Check if you see any mentioning of e.g. Debian, RedHat, or Centos.
I am not sure if this is fixable. Usually webservers like Apache support IP-based virtual hosts. If a masshoster like godaddy is really going to address this is uncertain. Try to contact their support and see.
1]If you are using host headers, make sure you have a DNS entry pointing your URL to your IP
2]Telnet port 80 from a machine outside your network.If it fails then check with your ISP that port 80 should not block in firewall.

website can be accessed using ip but not with the url(domain name) in wamp

from default httpd.conf to updating the host file and httpd.conf i tried but the website fails to open with domain name give
in host file
<my current public ip address> <domain name>
in httpd.conf
Listen [my public ip]:port
then restart of wamp server and finally restart of PC and of-course change of ip is done in above all.
But of no use
Please help
Thanks for time and response
Aaron,
I think you are misunderstanding the function of the HOSTS file.
The hosts file acts a little like a local DNS Server. Any changes you make to it will only effect the single PC that you made the change on.
What the HOST file actually does
When windows starts it starts a service called DNS Client also known as dnscache. That service reads the HOSTS file and seeds the dnscache with any domain names you put in it and the ip that should be connected to for each domain name.
Any program (the browser in this case) that wants to connect to a domain, checks this cache first, to reduce accesses to an actual DNS Server out on the web and therefore speed up the conversion of domain name to Ip Address.
So if you want external users, i.e. anybody on the internet to be able to access your site you have to either purchase a real domain name and get it pointed to your WAN ip address, or use a Dynamic DNS service like DYNDNS or NO-IP, to mention only a few, and get that dynamic dns service to point to your WAN IP.
You will also have to change your Apache config so it will serve that domain name, my suggestion would be to create a Virtual Host to do this.
This post may help with the process of creating a Virtual Host

Home apache web server - final hurdle

Ok, so bit of noob question - having one of those days.
I have set up a home apache web server on Ubuntu. I have configured vhosts as I want to host multiple websites. These work fine in the local browser, e.g.
http://site1
http://site2
both display their various contents.
For the server side of things, I've configured port forwarding on my router to send all port 80 requests to the server IP.
When I go to an external browser and type in my servers external IP address I get the standard apache "It works!" message. When I type in ipaddress/site1 I get 404. The site1 is not in the standard apache default directory, I have it in home/username/Sites/site1 folder and httpd.conf file knows this.
How is it I can access these site1 and site2 sites externally?
Cheers
Just as you would do in your local browser. So typing in http://site1 would lead you to the first site. This is based on an assumption though, which is that you put the http://site1 address in your /etc/hosts file. When your computer looks up an URL, it first checks the hosts file (and your case will find the correct IP address there) and next will ask a global mechanism for the address.
The reason why it doesnt find anything at "ipaddress/site1" is because of the vhosts configuration. This teel Apache serve the content of a folder somewhere on your server as a separate hostname, e.g. http://site1. If you're requesting "ipadress/site1", you're actually telling Apache to look in the folder "site1" in its first root it encounters in your Vhost configuration.

IP address is shown in address bar instead of domain

I have a WAMP home web server up and running on a static IP and registered a domain with Namecheap, but I'm a bit shaky with DNS. At first I used URL Redirect and pointed it to my IP. This meant that when you typed in the domain (like example.com) it just redirected you right to my IP, replacing the domain name with it in the address bar. Now I'm trying to get the domain to show instead of the IP in the address bar, which I'm struggling to understand exactly how to do.
The latest thing I've tried which many people say to do is instead of using URL Redirect to use the A (Address) record type and point it to my IP, which I thought would finally fix my problems. Of course after 15 min or so when it all got updated I'm getting a 400 Bad Request with nginx under it in Firefox, and a blank page in Chrome. Now I'm getting blank pages in both. Did I do something wrong here? Do I need to edit something on the web server such as httpd.conf? Am I going at this completely wrong?
Yes you should do away with the redirect and instead create an "A record". The sub-domain entry would typically be, but is not restricted to "www". The record type "A" and destination/target would be your external IP address. Once you update this record it may take several hours before you notice it taking effecting, upon where on people typing your URL would be directed to your web server.
You will need to forward port 80 on your router to the server hosting WAMP.
Finally the WAMP server should be provided with your domain name so it knows which site to load. If use the VirtualHost file this will allow you to host multiple domains on your web server. To do this...
Uncomment the following line so it appears like below in your Apache httpd.conf, to allow Apache to use virutal hosts
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then locate the httpd-vhosts.conf file, should be found in your WAMP installation location, such as C:\wamp\bin\apache\apache*version_number*\conf\extra\
Add an entry for your site, altering the details to your own domain name and website location.
<VirtualHost *:80>
ServerName www.stackoverflow.com
ServerAlias stackoverflow.com
DocumentRoot "C:/websites/stackoverflow/"
ErrorLog "C:/websites/stackoverflow/logs/error.log"
CustomLog "C:/websites/stackoverflow/logs/access.log" common
</VirtualHost>
Now restart your WAMP server and give it a whirl.
Tip: If your server won't start after these changes, check that you have created the folder structure for the log files!
Solution described here could resolve this issue.
Most of the free dynamic dns providers, allow acquiring more than one free host name. If allowed you can solve the problem by getting a second name, e.g., mysite2.somefree.org.
Now, go and configure your free domain names in the dashboard of free provider in the following way (assume your IP is 188.165.15.29 and your server's listening to port 8085).
redirect mysite1.somefree.org to mysite2.somefree.org:8085
redirect mysite2.somefree.org to your dynamic IP, say, to 188.165.15.29
This also works when you are using Apache httpd server alone, not being part of WAMP. You do not need to tweak virtual host or any part of your server. You only configure inbound direction.
Use Forward with masking where you registered your domain. mine is GoDaddy.
in the forward settings, you will see this at bottom of the page. click Forward with masking and add the title you want them to see in the address bar of the browser when they go to your site. instead of showing your IP address

How do I get access to localhost:3000 on OS X on a network using a windows machine?

I used to access localhost:3000 serving up an application via [computername].local:3000
The recent update of Mountain Lion removed Web Sharing
I have installed the Web Sharing preference pane found here http://clickontyler.com/blog/2012/02/web-sharing-mountain-lion/
but alas I'm still not able to access it from Windows XP on ie7
Any thoughts?
In order for other computers to be able to access it, they need to know where it is.
This is where the "hosts" file comes in.
On your Windows XP machine, open up notepad as an administrator. From notepad, click "File" > "Open" in the top menu.
Now open C:\Windows\System32\drivers\etc\hosts
The file should look something similar to what I've pasted below:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
Now, add the local IP address of your OSX machine with the hostname you want to access it by in the browser. You can find out your Mac's local IP address in the Network preferences pane (instructions can be found here: http://osxdaily.com/2010/11/21/find-ip-address-mac/ )
Example (assuming your Mac's IP on the local network is 192.168.0.100):
192.168.0.100 [computername].local
Save the file. Now your Windows XP machine will know that, in order to access [computername].local, it will need to contact the computer at 192.168.0.100
Assuming your web server is online, and configured to accept connections on port 3000, you can open up a web browser on Windows XP and type http://[computername].local:3000
If you still can't access it, also try the following and update your question with the results:
Temporarily disable the Firewall on OSX. Does this allow Windows XP to access it?
What error message do you get from Windows XP?