Can't access npm application from other device on the network - npm

I have just developed a node application. If I execute this command
npm run start
the application starts and I can access it at this address
http://localhost:8080/
The problem is that I want to access the application from my cellphone that is connected to the same wifi network as my PC. Therefore I have launched the ipconfig command on my PC and found out that in the section titled "Wireless LAN adapter Wi-Fi" the value of "IPv4 Address" is "192.168.x.y". So I opened the browser in my cellphone and typed the address
http://192.168.x.y:8080/
but nothing is displayed. Do I need to use Apache?

You might have to check if your firewall is opened on the port you are trying to access

The solution was to use Apache. The procedure is the following:
Install XAMPP
Go to the directory of the application and launch the command "npm run build". The resulting files will be saved in the "dist" directory. Among these files there should be a file called "index.html".
Copy the content of the "dist" directory into the "htdocs" directory located inside the XAMPP directory.
Start Apache through the XAMPP Control Panel.
Now it is possible to access the website locally through the "localhost" address. To access the website from another device you must use the ip address of the device where the website is deployed (that is your PC). In order to know the ip address of your PC launch the "ipconfig" command. The ip address of your PC is the value of the "IPv4 Address" property of the "Wireless LAN adapter Wi-Fi" section. You don't need to type the port, only the ip address.

Related

Open server and "How did you get here?"

I have a project folder and i installed open server. In settings open server in domains i set the domain I needed and the domain folder with a link to my project.
but it is not possible to enter the page after starting the server, writes "How did you get here?
To redirect requests for a local IP address to the local domain you need, create an alias in the program settings.".
In file hosts it is not displayed that the open server is working with the specified server, writes instead "127.0.0.1 localhost".
What could be the problem?

Xampp - How to find my ip address with version 8.1.6

I was watching this YouTube demo of connecting xampp to mysqlworkbench. The only issue I'm having is that this video was uploaded last year 2021, which I'm assuming was a different version of xampp where the ip address was visibly there.
However, my version of xampp does not have that and the closest I got was going on the apache web server openconfig file and going above Listen to find some ip address, however, that is failing when I test the connection on mysqlworkbench. Either the ip address given to me is incorrect or something is wrong with mysqlworkbench.
I would like to know however where I can find my ip address with this current version of xampp.
Are you using the local host address which is: 127.0.0.1
You can also type: localhost in the URL bar of your browser.
You should see the XAMMP welcome screen. That information is coming from a folder that you can access from the main "Open Application Folder". Go to "htdocs" and that is where you will put all your webpage files.

How can i create my own custom URL for my website i'm hosting

I have set up an apache server on my computer and I am hosting a website off of it. My url that is accessible via other computers on the network is my ip followed by the file path. For example 192.1.1.1/blog/index
I would like to be able to have users access my website by typing studioblog.com or just http://studioblog. How could i achieve this?
I have tried editing the localhost via /etc/hosts file but to no avail

Public IP Web Page "Connection Timed Out" When Connected To

Recently, I made a website server on my server PC running Windows 7. I used WampServer, and I configured it as follows:
Download and install WampServer.
Check http://localhost (worked).
Program out the HTML files necessary.
Put it inside of the 'www' directory (the default directory of WampServer for HTML files)
Go to http://localhost to see if it worked (yes, it did). Then right click WAMP notification and "Put online".
Go to my main PC and go to http://[local-ip-of-server-computer] to see if it worked. It did.
Now, I configured the httpd.conf to "Request all granted"
Next, I went on ahead to port forward. My router is Frontier Netgear router.
I went to 192.168.254.254 (Frontier's router addresss) > Firewall Settings > Port Forwarding > Add
I selected "World Wide Web (HTTP)" and "OK".
Then I went to the menu and to "DMZ Host". I enabled my server computer for that.
With my main PC, I went on ahead to my public WAN IP mentioned on the router page. It didn't work.
Whenever I try to load my http://[router-public-wan-ip], Google Chrome gets a "Webpage not avaliable. ERR_CONNECTION_TIMED_OUT"
I have port forwarded on my server PC's Windows Firewall.
My httpd.conf is set to be on port 80. Also, I have changed my ServerName to [local-server-computer-ip]:80.
Can anyone provide any advice? Thanks.
This was my mistake. The solution to this problem is that, well, there was no problem at all. I simply hadn't realized that external IP addresses cannot be accessed by their own servers - one inside of the server LAN has to use the server computer's local private IP address.
I sincerely apologize. Thank you to all who contributed.

Access my MAMP websites (plural) locally from my iphone

I have created a few websites locally on my mac using MAMP PRO as my local server environment.
I can access these on my mac as I have the opion of adding a local domain (in MAMP PRO) using "local name resolution"
But... I don't know how to access my sites from my iphone which I need to do to test.
If I put my local IP in (on my iphone) I get the MAMP holding page:
The virtual host was set up successfully.
If you can see this page, your new virtual host was set up
successfully. Now, web contents can be added and this placeholder
page1 should be replaced or deleted.
Server name: localhost Document-Root: /Applications/MAMP/htdocs
So I know that works but how do I access my indevidual sites.
The location and structure of my sites are like this:
/Users/myusername/Sites/vhosts/site1/public_html
/Users/myusername/Sites/vhosts/site2/public_html
/Users/myusername/Sites/vhosts/site3/public_html
/Users/myusername/Sites/vhosts/site4/public_html
Could this be to do with the localhost Document-Root? I noticed it was /Applications/MAMP/htdocs
Should I change that or change the location of my sites to be in /Applications/MAMP/htdocs?
Thanks
C
UPDATE:
Ok, so I changed my Document-Root to /Users/myusername/Sites/vhosts/ which now allows me to load the site localy in my browser with 192.168.1.134/site1/public_html
BUT.. when I load 192.168.1.134/site1/public_html from my iphone (on the same wifi network) I get the page title but the page doesn't load. Just hangs!
I use ngrok to forward my localhost and would recommend it. After installing it (it's free), you essentially run something like "ngrok 80" and ngrok will create a public URL that can be accessed from anywhere (AKA your phone) and displays the same content that http://localhost/ would.
Apologies I can't post full http:// links- I'm limited by my reputation.
In your example, ngrok might create a domain "hs673gs.ngrok.com" that corresponds to "localhost" when accessed from your local machine. Going to "hs673gs.ngrok.com/site1/public_html" from your iPhone will be essentially the same as visiting "192.168.1.134/site1/public_html" on your local machine.
Hope this helps.
MAMP has launched an app where you can see your local websites on your mobile through their app MAMP Viewer: https://itunes.apple.com/de/app/mamp-viewer/id1047237620?l=en&mt=8
You just configure the host that you want to use for MAMP Viewer:
Select the host you want to view on MAMP Viewer > On General tab, make sure to check, "for 'MAMP Viewer' (LAN only)" > click save > restart your servers > open the app and check your sites.