Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one access http://localhost/ using the command line

I installed apache2 on ubuntu and I want to check that it works by accessing http://localhost/. The problem is I installed ubuntu(17.04) server, so there is no web browser, only the command line.

What can I do?

like image 611
DR. Palson_PH.d Avatar asked Aug 16 '17 19:08

DR. Palson_PH.d


People also ask

How do I access my localhost?

To access the server from itself, use http://localhost/ or http://127.0.0.1/ . To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address. You can find the sever's local IP address (assuming it's Linux) by running hostname -I . 127.0.

How do I find my local host in CMD?

First, click on your Start Menu and type cmd in the search box and press enter. A black and white window will open where you will type ipconfig /all and press enter. There is a space between the command ipconfig and the switch of /all. Your ip address will be the IPv4 address.

How can I access localhost from anywhere?

For Windows users, you'll need to make sure you have Python installed first. For macOS and Linux, you can use a simple cURL command to install it straight from your command line. It'll run through and sign you up to the service if you're not already signed up. Then you'll have localhost up and running for the world!

How to access localhost from the Internet?

Note: To open a command prompt, you can press Windows + R keys (⊞ Win + R), then type “cmd” and click on Enter. If your application is running on local port 3000, then use this command: With the help of these three services, you can access localhost from the internet.

What is a localhost name?

Not just a term, localhost can also be a domain name, like netflix.com or google.com. Just like any domain, the localhost will also have its own Internet Protocol (IP) address. The address needed will depend on the internet protocol being used.

How do I ping to localhost?

To perform a ping request to localhost: 1 Open the Run function (Windows key + R) dialog and type cmd. Press Enter.#N#You can also type cmd into the Taskbar Search... 2 You can also type cmd into the Taskbar Search box and select Command Prompt from the list. 3 Running as Administrator is advised. 4 Type ping 127.0.0.1 and press Enter. More ...

How does http://localhost work on a router?

If you acces "http://localhost" in the browser, the request will not be forwarded to the internet through the router, but will instead remain in your own system. Localhost has the IP address 127.0.0.1, which refers back to your own server. Exemplary representation of the communication between a web browser and web server within a local computer


2 Answers

curl localhost (curl localhost:8080 if it's not port 80)

or

curl 127.0.0.1

or just test with

ping localhost

or download your index.html or something

wget localhost
like image 185
R_Ice Avatar answered Oct 12 '22 16:10

R_Ice


I recommend installing a browser for a command line like lynx ,Browsh.

Lynx is light-weight. Fast. An img element is always shown in their alt text. Browsh is a bit slower than Lynx. An img element is always shown ing(but as low quality as your command line can display).

I use different above depending on the purpose. If you just want to see the localhost is working well, use lynx. If you want to check your server working well and see details, use Browsh.

I hope my answer will help you. Any questions, google or ask me.

like image 3
Og Amayokoy Avatar answered Oct 12 '22 16:10

Og Amayokoy