Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view html file in remote unix server?

Tags:

html

unix

ssh

I currently have an html file on a remote unix server that I ssh to. I have been using SFTP to constantly transfer it to my local machine to view it after my edits, but I am tired of this.

What is the best program/method for Mac users to have a browser window view of the html file that is stored in a remote unix server? Or is there an ssh client that can easily edit html files?

like image 818
cjavier70 Avatar asked Jan 14 '14 21:01

cjavier70


People also ask

How do I view HTML files on Linux server?

Once you have ssh'ed into the server, install a web server in that box. Say the file is named index. html, you should make it available at the URL http://localhost:8000/index.html or port number can be anything.

How do I open an HTML file on a remote computer?

On a remote computer, a code documentation (static html pages) is located at /path/to/docs . To access it, the recommended way is to start NoMachine, get a virtual desktop, start the web browser (firefox) and open file:///path/to/docs .


Video Answer


1 Answers

It is possible, but with some playing around on the server.

Once you have ssh'ed into the server, install a web server in that box. Say the file is named index.html, you should make it available at the URL http://localhost:8000/index.htmlor port number can be anything.

The simplest method I can think of starting a web server at that location is

cd /directory/where/html/is/present python -m SimpleHTTPServer 8000  # For python 2 python3 -m http.server 8000 # For python 3 

This works provided python is installed on the server. It should not be that hard to install it as python is available from almost every package manager in every flavor of linux.

Now that html is available at python

http://localhost:8000/index.html

on that machine.

But we have not yet configured the browser in such way.

To do that you need to ssh into the server again, but with a -D option this time

ssh servername -D 7000 

-D specifies application level tunneling when connecting via ssh

Then in Firefox, preferences/options -> Advanced -> Networks -> Connection Settings -> Choose Manual Proxy configuration

SOCKS HOST should be localhost , port no 7000.

Then the html should be directly available at

http://localhost:8000/index.html

in your Firefox browser.

This feature is only available in the Firefox browser.

like image 165
Anoop Avatar answered Sep 29 '22 08:09

Anoop