local host

Asked by Daniel Brumbaugh-Keeney

Is there a good program which would serve all html pages in ~/site as if ~/ were the root?

For example:
<link rel="stylesheet" href="/styles/main.css" />
would be interpreted to mean ~/site/styles/main.css

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Ralph Janke
Solved:
Last query:
Last reply:
Revision history for this message
Ralph Janke (txwikinger) said :
#1

Thanks for the question.

I am not sure if I understand the question in its entirety. Html pages are usually "served" by the web server. Most people use apache for this. In the apache configuration, every virtual server is assigned a "document root", i.e the top level folder from which all references start.

There is also a module for apache available, which automatically allows public web sites for every user, such that a pase reference as "http://<server>/~<accountname>/..." would lead to the associated page inside the users home folder.

I hope this is about what you are looking for. If not, please try to explain a little more what you are trying to do.

Hope this helps.

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#2

I don't actually run a server on my computer at this time. I am looking for something which would act as a server for some local files, just on my computer. The idea is to preview what it will look like when uploaded on another host.

I want to point browser to something like
http://localhost:3000/about
and be viewing the page
~/site/about/index.html
with all absolute links on that page considering ~/site to be the root (see above example)

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#3

The most important thing is absolute links, converting foldername/index.html to foldername is less significant.

Revision history for this message
Best Ralph Janke (txwikinger) said :
#4

I am not aware of any software that does this. I think, the easiest is to run a simple web server locally to test it before you upload it to the other server.

I hope this helps.

Revision history for this message
David Futcher (bobbo) said :
#5

You can view HTML pages using you web browser. In Firefox go to File->Open File. As for the absolute links, i think these have to be hard coded into you link tags so instead of <a href="hello.html"> you would use something like <a href="/home/user/site/hello.html">.

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#6

Thanks Ralph Janke, that solved my question.