+ 5

[HELP] How can I connect to my laptop localhost virtualized by wamp server remotely with any device and in anywhere?

I searched a lot and surely I got a lot of tips and advices and configured wamp just like valid website like stackoverflow.com and etc but I still can't connect with another pc to my laptop public IP address or even in the laptop with its public IP. The error in browser: connection reset my wamp version : 3.2.3 the port I'm try on is : 80 my router model: ZyXEL DEL1201-T10A I'm using windows and also tried with firewall disabled. where can be the problem?

30th Dec 2020, 12:03 AM
hamid
hamid - avatar
81 odpowiedzi
+ 8
[Part 1 of 9] Oof... Reading this thread is painful. The context is all over the place and there are still several unknowns which could help fill in the holes. hamid... First... let's not be silly about pretending you purchased a copy of Navicat. Your hosts file says it all. This host entry is redirecting attempts from Navicat to activate against a licensing server which is likely another service on your computer that will generate a cracked key and return it back to Navicat. Your lack of concern about security is like handing firearms to a kid who plays Call of Duty all day. Except this firearm is loaded with live rounds and doesn't have a safety switch and we're like saying good luck kid with everything. It's obvious you're well beyond your depths here and you not being completely forthcoming on everything is likely making it more difficult for Kode Krasher to effectively help. All said... I'll follow up with a few of the missing details and perhaps that will help you get closer to figuring this out.
30th Dec 2020, 7:01 PM
David Carroll
David Carroll - avatar
+ 7
[Part 4 of 9] Yet, trying to access your external WAN IP from your computer will create a DNS loop never resolving the site. Ultimately, your hosts file should contain the following: ---- 127.0.0.1 localhost ::1 localhost 127.0.0.1 activate.navicat.com 192.168.1.35 remotehost ::1 remotehost ---- You do NOT want to map localhost to the LAN IP. localhost must point to your loopback address 127.0.0.1. Otherwise, you'll run into issues if disconnected from your network or your LAN IP changes. Adding entries for your WAN IP will result in the constant DNS looping where http://remotehost resolves to your WAN IP, which sends the request to your router from the outside in, then forwards to your local machine, which then routes it back to your WAN IP, and the cycle continues. (At least, that's how I'm imagining it. I would need to confirm this.) (continued...)
30th Dec 2020, 7:58 PM
David Carroll
David Carroll - avatar
+ 6
[Part 2 of 9] [Regarding IP Addresses] If you are trying to open your computer up to the internet, there are 3 IP addresses to be aware of: localhost -> 127.0.0.1 LAN IP -> 192.168.1.35 WAN IP -> 100.87.***.** Assuming this is correct, you should probably remove the WAN IP from the post to prevent all the wanna-be script kiddies and their mothers from going to town on pentesting the heck out of your network in the name of "ethical hacking". 🤣 NOTE: The localhost and LAN IP point to the same computer. localhost is only accessible from your computer. So your IP bindings need to reflect the LAN IP, not localhost IP. This is an important concept to understand. With this in mind, I have the following questions: 1. What the heck is the DNS for "remotehost" used for? If that's the DNS used for external access, that's a strange name to use. 2. Are you hosting 2 separate web applications or only 1? If two, you should get one working first. (continued...)
30th Dec 2020, 7:34 PM
David Carroll
David Carroll - avatar
+ 6
[Part 3 of 9] 3. If you are only working with a single website, then what's up with working with two separate ports: 80 and 6613? If port 6613 is being forwarded from the WAN IP to port 80 on your local web server, you don't need to register any bindings for port 6613 on your web server. [Regarding your hosts file] The hosts file you presented is pretty jacked up. I'll try to explain. First... the following lines set your computer to resolve the domain names to the same IP address (which is fine): 127.0.0.1 localhost 127.0.0.1 remotehost However, these get overwritten with new IP addresses with the following lines: 192.168.1.53 localhost 192.168.1.53 remotehost And finally, these lines: 100.87.xxx.xx localhost 100.87.xxx.xx remotehost If you ping localhost or remotehost, the last assigned IPs will resolve when pinged from your computer. (continued...)
30th Dec 2020, 7:50 PM
David Carroll
David Carroll - avatar
+ 6
[Part 5 of 9] [Regarding Ports] If this is a single website, I'm assuming port 6613 is used for the WAN IP. If so, then http://192.168.1.35:6613 should NOT resolve to anything. Rather, access to the same website would likely appear as follows: When Accessed From Local Computer: - http://127.0.0.1/ - http://localhost/ - http://192.168.1.35/ - http://remotehost/ - http://100.87.xxx.xx:6613/ When Accessed From Another Device on Same Network: - http://192.168.1.35/ - http://100.87.xxx.xx:6613/ When Accessed From Another Device on External Network: - http://100.87.xxx.xx:6613/ Notice that port 6613 is only used with the WAN IP. (continued...)
30th Dec 2020, 8:06 PM
David Carroll
David Carroll - avatar
+ 6
[Part 6 of 9] [Setup dev.hamid.com] Let's say you want to simulate a more formal domain name without registering an actual domain. This domain will only be used on computers you configure. Then consider replacing "remotehost" with something like "dev.hamid.com" in the hosts file on both your computer and your external computer. Local computer hosts file: 192.168.1.35 dev.hamid.com External computer (outside network) hosts file: 100.87.xxx.xx dev.hamid.com Also, add "dev.hamid.com" as a ServerAlias entry in your vhosts.conf file. Then, you should be able to access the website using the following address: From within your local computer hosting the website: - http://dev.hamid.com From outside your network: - http://dev.hamid.com:6613 NOTE: If your WAN IP changes, the external computer's hosts file will also need to be updated. Also... you should add an IP Filter on your router to limit which computers can access your website using the WAN IP.
30th Dec 2020, 8:17 PM
David Carroll
David Carroll - avatar
+ 6
[Part 7 of 9] [Ping Testing Steps] Before spending any time with Apache / WAMP, I would do a set of ICMP ping tests from the respective computers to make sure the hosts files are working. You might need to enable ICMP on your router for this to work on the WAN IP. Verify the following pings resolve to the correct IP: From Local Computer: ping 127.0.0.1 (resolves to 127.0.0.1) ping localhost (resolves to 127.0.0.1) ping 192.168.1.35 (resolves to 192.168.1.35) ping dev.hamid.com (resolves to 192.168.1.35) ping 100.87.xxx.xx (resolves to 100.87.xxx.xx) From Another Device on Same Network: ping 192.168.1.35 (resolves to 192.168.1.35) ping 100.87.xxx.xx (resolves to 100.87.xxx.xx) *NOTE: I'm assuming your not changing the hosts file on your mobile device. From Another Device on External Network: ping dev.hamid.com (resolves to 100.87.xxx.xx) ping 100.87.xxx.xx (resolves to 100.87.xxx.xx) Notice the resolved IP depends on where the request is coming from.
30th Dec 2020, 8:32 PM
David Carroll
David Carroll - avatar
+ 6
[Part 8 of 9] [Port Testing Steps] Next, before configuring your WAMP / Apache settings, I would use a lightweight web server to test your port forwarding rules. There are a number of solutions you can use. For my instructions, you'll need to install NodeJS then run the following command: npm install -g http-server Next, be sure to shut down WAMP completely. Then create a folder with an index.html file containing something like "<h1>BOOM! You can see me!</h1>"
30th Dec 2020, 8:44 PM
David Carroll
David Carroll - avatar
+ 6
[Part 9 of 9] [Port Testing Steps] Then, from terminal / command prompt, cd into the folder you just created and run the following command: http-server -p 80 Now, confirm the expected message from the index.html loads: From Local Computer: - http://127.0.0.1/ - http://localhost/ - http://192.168.1.35/ - http://dev.hamid.com/ - http://100.87.xxx.xx:6613/ From Another Device on Same Network: - http://192.168.1.35/ - http://100.87.xxx.xx:6613/ From Another Device on External Network: - http://dev.hamid.com:6613/ - http://100.87.xxx.xx:6613/ If the test web page loads, then move on to the WAMP / Apache settings. I'll leave the rest up to you. Best of luck and try to make security a priority.
30th Dec 2020, 8:44 PM
David Carroll
David Carroll - avatar
+ 5
and when insert 192.168.1.35:6613 I see my file in the defined folder for remotehost and this is access.log: 192.168.1.35 - - [30/Dec/2020:21:20:33 +0330] "-" 408 - 192.168.1.35 - - [30/Dec/2020:21:22:54 +0330] "GET / HTTP/1.1" 200 785 but nothing happend in apache error.log These was on my device that have wamp navicate and ... and my navicate is premium 15 and also I can connect to my database and it's okay
30th Dec 2020, 5:54 PM
hamid
hamid - avatar
+ 5
hamid This thread is a mess 🤦‍♂️. None of my questions were answered, so I really have no idea if you're configuring 1 or 2 websites. If it's one website, then port 6613 should only be used with the WAN IP. That means I disagree with the following LAN IPs working: http://192.168.1.35 <- Good http://192.168.1.35:6613 <- Bad I strongly recommend starting over and carefully read each of my 9 earlier responses in isolation. Don't respond with all the different URLs that didn't work. Most of those reveal you clearly don't understand what's going on with the random trial and error approach to every combination of IP / domain and port. This is so much simpler than you realize. But if you lack the patience to understand the fundamentals, we're all wasting our time trying to give you direction on something that quite frankly would only take a few minutes to setup.
1st Jan 2021, 8:15 PM
David Carroll
David Carroll - avatar
+ 5
hamid If you can understand English well enough, I might create a screen recording walking you through the steps and clarifying each step. But I don't want to go through the effort if it will be hard to understand. Let me know if that would help. I can't make any promises. I'm just considering it as an alternative to consider.
2nd Jan 2021, 2:25 AM
David Carroll
David Carroll - avatar
+ 4
plus this from access.log: 127.0.0.1 - - [30/Dec/2020:21:12:48 +0330] "GET / HTTP/1.1" 200 6433 127.0.0.1 - - [30/Dec/2020:21:13:30 +0330] "GET / HTTP/1.1" 200 6433 127.0.0.1 - - [30/Dec/2020:21:13:30 +0330] "GET /favicon.ico HTTP/1.1" 200 202575
30th Dec 2020, 5:52 PM
hamid
hamid - avatar
+ 4
Kode Krasher and till here I can connect and see the content of remotehost when I turn on my laptop hotspot but I try to connect to localhost(127.0.0.1:80) it says connection refuse which is fine but when i connect my phone to router that my laptop connected to for 192.168.1.35(remotehost) browser says took too long to response and for localhost it says connection refuse which not fine because it's ok if any device with same network wanted to connect to the localhost(192.168.1.35)
30th Dec 2020, 6:20 PM
hamid
hamid - avatar
+ 4
Kode Krasher you mean even for computers connected to the same router we need to setup router port forwarding ?
31st Dec 2020, 12:04 PM
hamid
hamid - avatar
+ 4
Perhaps you should use a proxy DNS service to get this to work and not try to learn the networking details until you're ready. One proxy service I've heard good things about is is part of the PHP Laravel framework: https://laravel.com/docs/8.x/valet In the meantime, I'm unfollowing this thread, so I won't be notified unless you mention me.
1st Jan 2021, 8:16 PM
David Carroll
David Carroll - avatar
+ 3
Kode Krasher I'm not using virtualize machine and also did the port forwarding.I set start port and end port to 80 and also I did the same for port translation just like what Slick said.
30th Dec 2020, 8:49 AM
hamid
hamid - avatar
+ 3
and this is my hosts folder in my laptop where I have wamp on # 127.0.0.1 localhost ::1 localhost 127.0.0.1 activate.navicat.com 127.0.0.1 remotehost ::1 remotehost 192.168.1.35 remotehost this is my laptop IPv4 ::1 remotehost 192.168.1.35 localhost ::1 localhost I have to host(names:remotehost and localhost) and both on port 80
30th Dec 2020, 8:57 AM
hamid
hamid - avatar
+ 3
and this my httpd.conf: #Listen 12.34.56.78:80 #Listen 0.0.0.0:80 #Listen [::0]:80 #Listen 0.0.0.0:${MYPORT6613} #Listen [::0]:${MYPORT6613} Listen 192.168.1.35:80 Listen [::0]:80
30th Dec 2020, 9:01 AM
hamid
hamid - avatar
+ 3
and here is my httpd -vhosts.conf # Virtual Hosts # <VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot "${INSTALL_DIR}/www" <Directory "${INSTALL_DIR}/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted #Require ip 192.168.1.35 #Require ip 192.168.1.41 #Require ip 192.168.137.227 </Directory> </VirtualHost> # <VirtualHost *:80> ServerName remotehost DocumentRoot "f:/remotehost/www" <Directory "f:/remotehost/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted #Require ip 192.168.1.35 #Require ip 192.168.1.41 #Require ip 192.168.137.227 </Directory> </VirtualHost>
30th Dec 2020, 9:03 AM
hamid
hamid - avatar