1

I am using Linux Fedora. I have Xampp/Lampp installed.

enter image description here

I have run Xampp/Lampp from terminal

sudo su 
/opt/lampp/lampp start

Output :

Starting XAMPP for Linux 8.0.2-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

I am able to open localhost following ways on laptop.

http://127.0.0.1/dashboard/
http://localhost/
http://192.168.0.106/dashboard/

My ip is 192.168.0.106

enter image description here

But, when I was trying to open it in Android Device it's not working..

enter image description here

What to do now? How can I access localhost from my Android Device?

I was reading the answer also. It's not helpful also..

enter image description here

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Should I edit anything?

@Tenso enter image description here

>NAME=Fedora
>
>VERSION="33 (Workstation Edition)"
>
>ID=fedora
>
>VERSION_ID=33
  • You probably need to open port 80 on your linux machine, I think best tool for that would be ufw or you can use iptables if you're familiar with it. – Tenso Mar 16 '21 at 06:42
  • @Tenso How to do that? I found this [link](https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands). I am sure that I have `iptables` installed cause, when I run `sudo iptables -S` I got output... So, what to do now? –  Mar 16 '21 at 06:44
  • 1
    Here is the tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04 But I don't know if ufw is available for fedora, maybe there is some other packet, that can help you with this – Tenso Mar 16 '21 at 06:46
  • @Tenso I had run `sudo nano /etc/default/ufw`. ufw is completely null. There's no source code... I am installing ufw `sudo dnf install ufw` https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-debian-10 –  Mar 16 '21 at 06:49
  • I found for fedora there is some other way to do this: https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sec-Open_Ports_in_the_firewall-CLI.html – Tenso Mar 16 '21 at 06:53
  • @Tenso I have done something could you please see my edited question –  Mar 16 '21 at 06:58
  • @Tenso I tried [it](https://docs.fedoraproject.org/en-US/Fedora/19/html/Security_Guide/sec-Open_Ports_in_the_firewall-CLI.html) also. nothing is happening –  Mar 16 '21 at 06:59
  • Probably your server is bound to 127.0.0.1 or to that local ip. Dont bind to anything. And if you have too then bind to 0.0.0.0. – blackapps Mar 16 '21 at 08:14
  • @blackapps I am not sure my server is bound to 127.0.0.1 or not? How to check that? In this question I earlier mentioned, I am able to run localhost by ip... –  Mar 16 '21 at 15:54
  • You should look in your server settings or its code. But if http://192.168.0.106/dashboard/ works then it is probably ok. – blackapps Mar 16 '21 at 17:06
  • @blackapps I gave a picture of and code of `httpd.conf` –  Mar 17 '21 at 03:52
  • `But, when I was trying to open it in Android Device it's not working..` Your device can open nothing. You need to use an app. Which app are you using? Can you finally edit your post not talking about localhost but to the point? – blackapps Mar 17 '21 at 06:35
  • @blackapps Isn't there way to visit the [page](https://192.168.0.106/dashboard/) in Android? When I was using Windows I was able to visit that [page](https://192.168.0.106/dashboard/) –  Mar 17 '21 at 07:04
  • Did you try a browser on your Android device? – blackapps Mar 17 '21 at 10:48
  • @blackapps Yes! I gave a picture of it also.. –  Mar 17 '21 at 15:12

1 Answers1

0

Don't different devices have different IP addresses? I've also sometimes tried localhost from Android, but it never seems to work. Just guessing that it can only be accessed from the device that it's hosted on.

ouflak
  • 2,458
  • 10
  • 44
  • 49
  • I earlier had worked on Windows.... I could work with that... I had changes some codes from `Xampp`... Then, it was working when I was in Windows. But, it's my first time... I am trying to run localhost from Linux.. If you are using Windows I will suggest you to search on Google and YouTube how to solve your issue.... –  Mar 16 '21 at 06:21
  • 1
    I don't need localhost I was just saying that it's never worked for me in any situations that I would start a localhost from another device. –  Mar 16 '21 at 06:22
  • 2
    Every device is its own localhost. So if a client tries to connect to localhost it tries to connect to a server on that same device. The same for 127.0.0.1 – blackapps Mar 16 '21 at 08:16