I'm doing local php development with apache and virtual hosts. For some reason my virtual host sites have stopped responding.
Chrome error:
This web page is not available
ERR_ADDRESS_UNREACHABLE
Firefox error:
Server not found.
I haven't made any change to the server config or php ini files since I set them up, and the sites were working fine earlier today. This affects all the virtual host sites I created, but apache still seems to be running fine on localhost.
I've tried restarting my system (ubuntu) and checked the apache access and error logs. Attempts made to access virtual hosts are not logged at all (since the problem started).
I have no idea what's going on. Does anyone have any advice?
Thanks.
Ok, I've solved it, but I think it's handy for others' reference.
My router had re-assigned my IP Address (I have no idea why). Therefore the IP Address in /etc/hosts for those virtual hosts domain names did not match the address of my dev PC.
Solution: I just updated the IP address in virtual hosts.
Another strange thing is the router seems to have removed all the IP Addresses of devices not currently connected. In the past it has kept them around even though they are not connected, but that's another matter and I should look into it (Well I think I had assigned them a static IP, but it's been a while since I've touched the router settings).
Related
I have an Apache2 server running in Debian 9.
I am using it to host a custom MediaWiki Wiki.
To navigate to the Wiki I use something of this form "10.200.200.20/mediawiki" where the Apache2 server is running on 10.200.200.20.
This works fine however sometimes the IP Address (10.200.200.20) will change and then everyone on the local network navigating to the Wiki will have to be notified and use the new IP Address which is a hassle.
I wish to change it to something consistent, for example "OurWikiServer/mediawiki" it doesn't really matter that much as long as it can always be found at the same place.
I know this is possible as the MediaWiki installation was previously maintained by someone else who used XAMPP in Windows 7 and it was configured to be found at "stringHere/mediawiki" on the local network.
I have tried changing it in /etc/hosts and can get it changing on individual machines as expected, however have no idea how to get it working network wide.
The best way to do this is to define the IP of this station static. This can be done via reservation in DHCP server or assign IP outside of the DHCP IPs. Also consider adding small DNS server to provide hostname instead of IP
I'm using Digitalocean cloud hosting server and apache2 in Ubuntu 16.04 VPS. I can browse the site from my local PC and check apache access.log to see the page requests. However when using a mobile device, I cannot get a response from the website. I can ping the server IP address from my phone successfully. However, any requests for the domain root do not create any record in the access.log.
I have attempted to uninstall fail2ban as per this threads:
https://www.digitalocean.com/community/questions/how-to-debug-solve-a-err_connection_timed_out-error-when-this-error-happens-on-some-browsers-but-not-in-another
http://installion.co.uk/ubuntu/vivid/universe/f/fail2ban/uninstall/index.html
I have also tried simply serving a phpinfo() page. However, no still no records in access.log when trying to access from mobile devices. The site is has https enabled and is serving perfectly to a PC.
Also, using a browser testing site (https://www.browserstack.com/) I also get connection timed out errors, and no response records in the access.log.
Any suggestions on where to start troubleshooting this? Is this possibly a problem with Digitalocean itself? Is there anything in the LAMP stack that would specifically be blocking some browsers or IP addresses?
It sounds to me like one of two things is happening here:
Your DNS is not set to point to that IP, but you set it in your operating system's host file on your computer.
Your DNS is correct, but other systems are not yet seeing the change you've made.
Try visiting the IP of the server directly from your mobile device. If anything occurs besides timing out, be it a redirect (even if failed) or a page load, you will know that DNS resolution is the issue. Given that you can ping the IP from your phone I would suggest fail2ban is not related, as fail2ban should block ping as well.
If it turns out to be #2 there, it's just a game of waiting. DNS changes can take up to 48 hours to be seen by all systems. In most cases 4-6 hours is common, but 48 hours is still the recognized standard of "it could possibly take this long."
Jarland
First, I already searched stack overflow and followed the suggestions in previous answers, such as How do I connect to this localhost from another computer on the same network?
I have created a PHP/MySQL application for a client. The want to host it locally on that server.
The machine in question is running an application written in another langauge (I'm not sure which one) and running Tomcat on port 8080.
They also do not have separate staging/production environments, so this is not ideal.
Their other web application needs to remain running while I also port over the new app. I installed XAAMP onto their system and got the app running locally using Apache HTTP. However, they want other computers both within and outside their networks to be able to connect to the Windows server as well. They are already doing this for the previously created app that is running on Tomcat.
Ports 80 and 8080 are already being used, so the firewall was updated to allow my application to run on port 8086.
I used ipconfig to the find the local IPv, and then tried updating the http.conf and vhost file and am listening to the IP on port 8086. However, going to the IP/foldername doesn't resolve on another computer in the network. As a test, I also just typed in the IP of the windows machine, and it never resolves.
I generally don't implement of windows; until now, all of my production applications have run on some flavor of unix. Their other application is live and I don't want to disturb it. They access it by going to {servername}:8080. I tried server:8086 to see if my app could be accessed that way, but it can't.
I confirmed that localhost/foldername resolves.
Here are the exact steps that I have taken. I tried two different solutions.
Solution 1, using How do I connect to this localhost from another computer on the same network? as a guide:
Make sure firewall allows port 8086 access
I modified the C:\xampp\apache\conf\extra\httpd-vhosts.conf file to include a virtual host for the application:
DocumentRoot "C:/xampp/htdocs/{foldername}"
ServerName dispatchserver
Went to the Windows host file located at \Windows\system32\drivers\etc\hosts and added the following:
192.xxx.x.xx dispatchserver
From a computer outside the network, tried to go to the following URLs (non resolved):
http://192.xxx.x.xx
http://192.xxx.x.xx:8086/
http://192.xxx.x.xx/foldername
http://dispatchserver
http://dispatchserver/foldername
Since they didn't work, I tried a solution using this older stack overflow answer: Accessing localhost (xampp) from another computer over LAN network - how to?
Made sure firewall allows port 8086 access
XAMPP control panel > Config > Service and Port Settings > Apache > Changed main port to 8086.
XAMPP control panel > Apache > Config > http.conf
Searched for "Listen 80" and replaced with Listen 8086
Right above that, added Listen 192.xxx.x.xx:8086 (I used the IPv4, but don't want to include full address for security reasons). I added this line with hashtag at first (#192.xxx.x.xx:8086) and then without hastag after that didn't work (192.xxx.x.xx:8086).
Searched for and set this up as the directory statement:
AllowOverride All
Require all granted
Restart Apache
What steps can I take to allow the new webapplication I installed via XAMPP to be accessible to other computers?
In that case it's a little different if you want to web enable this. You need to set up your router to port forward to your server (app)so that the other network can reach it from the internet. Your router blocks incoming requests by default so a port forwarding rule using the port you mentioned will work. You should also put your server computer (the one with the app) on a static ip address to make things easier. Then for the user to see your app you need to give them the ip address of your internet connection (seen via sites like ipchicken.com) and the port number in the url.
Normally you just need to open the ports in the windows firewall on both computers (inbound and outbound) for the ports your application is using and then connect to the other machine via ip address and port number if they are on the same network.
I have few PCs in same network. One of the machines (ip: 192.168.1.110) is already hosting a WAMP server which is accessible through an external IP. I now want to install WAMP server on one more machine (ip: 192.168.1.120) and make it accessible through external link. But this new machine is not getting accessed through external link. Is there any configuration related stuff that I need to do in httpd.conf file to make it happen?
There are a number of issues with your idea of using a second PC running a second WAMPServer. Not that 2 machines and 2 WAMPServers is a problem.
First, I assume your router has already had port 80 "Port Forwarded" to the original PC's IpAddress (ip: 192.168.1.110). It cannot be forwarded to 2 different internal IP addresses, unless you tell people to use a different port number for the second sites domain name so that you can forward that other port to your second PC's port 80.
This leaves you a couple of possibilities :-
You either setup the original PC's Apache as a Proxy for the second PC and therefore forward accesses for the second site to the second PC while still running the first site on the first PC
Or, more simply in my opinion you stay with One PC running WAMPServer and you make use of Apache's Virtual Hosts capabilities.
This way as long as you have 2 seperate domain names, both pointing to your Routers WAN IP address both can still use port 80 i.e. Users dont need to add a port number. Apache will decide what site is required and run that site by simply looking at the domain name and redirecting everything to the right place.
See this post for some help on how to setup Virtual Hosts in WAMPServer
Its should only take a few minutes to setup.
I've got a local Apache2 server on Ubuntu 12.04
with virtual hosts, so in the 'hosts' file I pointed
the virtualhost name to the local IP address -192.168.1.33-.
So 'http://mySite.local' points to '192.168.1.33', it works fine
in the browser.
Now I want to test the same in a cellphone connected to the machine
through a wlan-adhoc network created in my notebook with shared connection.
I can see the root folder if I access to '192.168.1.33' correctly,
but not if I access to 'http://mySite.local'
I assume the '/etc/hosts' file is not affecting the traffic through the adhoc network.
is this correct? Can I change this behaviour? is possible?
You are correct to assume that the hosts file only affects connections that originate from the machine to which the host file belongs. Other traffic already needs to know the IP address it will need to connect to before it reaches your machine. Depending on how much access you have to your phone, getting it to recognize your own domain name like this maybe more work than it's worth.
I say this because you would need to do one of the following:
Edit the equivalent of the hosts file on your phone (if such a file exists in an accessible way)
OR
Set up a local DNS server to serve this info to your phone AND get your phone to use it for DNS resolution.
Without knowing what phone you have, I can't say for sure how hard either of these will be. But I would guess neither one is going to be nearly as easy as typing in the IP and bookmarking it in your phones browser.
The hosts file only works for the machine it is local on. It is not passed on or used as a data source for any DNS service. You would have to have a hosts file local to your cellphone, and I'm not sure that this is possible.