I am setting up apache on my machine to serve some static content. I am running into the following issue:
The public IP address of my instance is: 54.203.56.245 and the domain which maps to this instance is timelines.co. The DNS propagation has happened long back and when using another server, I am able to successfully access my website like this: http://timelines.co
With HTTPD, I am able to access my website like this: http://54.203.56.245 (you can try it out in your browser). However, I am not able to access it like this: http://timelines.co -- I get a 'timeslines.co refused to connect' error (ERR_CONNECTION_REFUSED).
What could be the reason for this? I have been playing with Virtual Hosts, but to no avail.
This is what my httpd.conf looks like - I have added this at the bottom:
IncludeOptional /etc/httpd/sites-enabled/*.conf
This is what /etc/httpd/sites-enabled looks like:
timelines.co.conf -> /etc/httpd/sites-available/timelines.co.conf
This is what /etc/httpd/sites-available/timelines.co.conf looks like:
<VirtualHost *:80>
ServerName timelines.co
ServerAlias www.timelines.co
DocumentRoot /var/www/timelines.co/html
ErrorLog /var/www/timelines.co/log/error.log
CustomLog /var/www/timelines.co/log/requests.log combined
</VirtualHost>
What am I doing wrong?
Edit 1:
On my local computer, I am able to open the website in Internet Explorer but not in Microsoft Edge and Chrome.
Edit 2:
I cleared all browsing data (everything) on chrome, and now the website is loading on chrome too. I have not cleared things on Edge yet and the website is not loading on Edge.
Edit 3:
I cleared all browsing data (everything) on Edge, and now the website is loading on Edge as well. It seems like some sort of cache issue. Not sure what though. Maybe a clash between DNS lookups stored in browser cache.
Maybe you have something in your HostFile that is blocking or making your browser get the Connection Refused. I checked over your Vhost and it looks correct. Your site actually works for me and I get the Success! The timelines.co virtual host is working!
Also, I checked for your DNS Record timelines.co also and it looks correct also
A records
IPv4 address 54.203.56.245
Related
I have a development server running Centos 7 I've setup in my living room. As of now I'm not using a domain, my ISP blocks port 80 so I've got Apache listening on port 8080.
I have a few different sites on here I've been playing with. One of them is a redmine installation, another is wordpress, and the other has dolphin on it. I can get any one of these 3 to run normally off the root ip xxx.xxx.xxx.xxx:8080 but when I try to setup an alias it points to the server's local ip. This works great from home, but I can't access them anywhere else.
I've setup a virtual host configuration in apache like this:
<VirtualHost *:8080>
DocumentRoot /var/www/html/wordpress
Alias /wordpress /var/www/html/wordpress
</VirtualHost>
When I open xxx.xxx.xxx.xxx:8080/wordpress it tries to redirect to the local ip 192.168.1.xxx:8080/wordpress I feel like I'm on the right track but I'm not sure where to go from here. Thank you.
I stumbled upon the solution today after running into something similar with a site I migrated for a client today. I was sure it had to be an apache issue.
The WP installation (and others) were pointing to my private IP as I'm not using domains for any of them. This is why I kept having the site redirect.
192.168.* are private network addresses. And by definition "IP packets addressed from them cannot be transmitted through the public Internet".
You have to get yourself a public IP or use a service like https://ngrok.com/.
Alias directive itself shouldn't cause redirect. There is something else (probably some Wordpress setting or .htaccess redirect) that is causing that when the page is opened (or not found)
I had to recently wipe my PC and I'm setting up my development environment again using WAMP.
After installing WAMP, if I visit http://localhost instead of seeing the WAMP homepage I get redirected to http://x.x.x.x, where x.x.x.x is my IP.
I had this issue on another PC and after setting the inbound rules for Apache HTTP Server in my Windows Firewall settings to allow all domains it fixed the issue. I applied this to my PC, and the issue does not seem to be present for Internet Explorer, whereas for Chrome and Firefox the localhost to my IP redirect issue persists even after clearing the cache for each browser.
My C:\Windows\System32\drivers\etc\hosts file looks like this:
127.0.0.1 localhost
::1 localhost
and my firewall rules look like this:
I am not currently using vhosts and I'm on a network at my workplace (if that has any implications?)
I also encountered the same issue when using Laragon which uses vhosts and whenever I visited a virtual host, e.g. mysite.dev it didn't work properly either.
My question on the Laragon forum: https://forum.laragon.org/topic/126/accessing-mysite-dev-redirects-to-url-which-shows-index-php-at-root-folder/3
The Problem
I'm behind a proxy which is used for browsing the web at my workplace. The proxy seemed to be messing up the dns resolution whenever I made a call to localhost (when using wamp) or one of my vhosts (when using Laragon).
This was clear as when I ran the following from the command line: ping site.dev I was getting the expected response from 127.0.0.1. However, when going to site.dev in my browser I was getting redirected to my IP, so essentially my etc/hosts file was being ignored for dns resolution.
The difference between the two being that the browser is using the proxy whereas the command line isn't!
The Solution
After trying many different solutions which seemed to work for localhost (on wamp) only, but not vhosts (on Laragon) I finally got to the solution which was actually so simple!
So, for chrome I simply went to chrome://settings/ > Network - Change proxy settings > LAN Settings > Proxy Server - Advanced
Then in the Exceptions text box I added the following:
*.dev;localhost;127.0.0.1
Here's a screenshot of my settings from Chrome/Internet Options
And that did the trick! Hope this can help someone else.
I'm having trouble figuring out how virtual hosting works. For example lets say in my 'hosts' file I have:
127.0.0.1 localhost
127.0.0.1 mysite1.com mysite1.com mysite3.com
Does this mean that whenever I type in localhost, mysite1.com, mysite2.com, or mysite3.com into my browser URL, the page loaded will be the same for all of them?
The /etc/hosts file only has limited connection to virtual hosting of Apache. The only thing you do with it is give your host (or rather the loop back interace lo) several names. If you haven't set up anything about virtual hosting yet (which I assume) typing
http://localhost/
http://mysite1.com/
http://mysite2.com/
http://mysite3.com/
as URL in your browser will all render the same welcome page (provided you have at least set up your Apache) because in all cases the browser will try to access the web server at 127.0.0.1 which your Apache usually listens to.
To create a true virtual hosting you now need to activate this feature in the configuration file of Apache using the tags
<VirtualHost mysite1.com:80>
...
</VirtualHost>
<VirtualHost mysite2.com:80>
...
</VirtualHost>
<VirtualHost mysite3.com:80>
...
</VirtualHost>
The simplest version of a virtual hosting would be that you define a seperate document root for each host and share all other configuration items. The details of this (represented by the ...), of course, would definitely be out of scope of this answer. A good start for reading would be http://httpd.apache.org/docs/2.2/vhosts/examples.html.
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
I have a server at work that is running windows server 2008. I have installed wamp on it and use it to host all my sites. For multiple sites, I include the following into the httpd.conf file:
<VirtualHost *:80>
ServerName www.NewURL.com
ServerAlias NewURL.com *.NewUrl.com
DocumentRoot "X:/www/NewURL/"
</VirtualHost>
After saving the httpd.conf file, I open up my DNS Manager, add the domain, and add 2 a records. The "Name" of the first is set to * (Making the FQDN = *.NewURL.com). I change the IP address to my servers local address (Let's say, 192.158.5.5).
This process has worked great for about 40-50 URLs, even allowing me to customerName.OldURL.com and still correctly retrieving the index.php file.
I have a new site I added to my httpd.conf file as well as my DNS manager. The website is available 100% while within my work ip address range, but when I test the site at home, only the main domain (www.NewURL.com) is reachable, not clientName.NewURL.com. clientName.NewURL.com times out and is unreachable according to www.isup.me. However, NewURL.com works just fine.
I've set up NewURL.com exactly as I have all the other URLs I'm running of this server. I've event gone through and started again from scratch... with the same result.
Anybody know of anything else I can check other than the virtual host settings and the DNS manager?