View previous topic :: View next topic |
Author |
Message |
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Thu Mar 01, 2018 1:44 am Post subject: [Solved] Local host site. |
|
|
I would like to add a local site accessable to me via localhost in the same way cups has its web interface on my machine its http://localhost:631/ how do I configure things so I can have maybe http://localhost:<my-site>
were do files go and how do I add this?
Last edited by The_Document on Fri Mar 02, 2018 9:26 pm; edited 1 time in total |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Thu Mar 01, 2018 2:47 am Post subject: |
|
|
You would need to install a web server such as Apache or Nginx.
You'd then need to "create a website" and tell the web server how to serve the website.
You can find examples of how to create a "Hello World" website, but depending on what you wan to do, it can be a very involved project. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Thu Mar 01, 2018 2:53 am Post subject: |
|
|
pjp wrote: | You would need to install a web server such as Apache or Nginx.
You'd then need to "create a website" and tell the web server how to serve the website.
You can find examples of how to create a "Hello World" website, but depending on what you wan to do, it can be a very involved project. |
I already have cups web admin ui didn't it come with an http server? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Thu Mar 01, 2018 2:58 am Post subject: |
|
|
I don't use cups. If it requires a separate package, then yes, it should have pulled something in.
Do you have any web servers installed? _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
The_Document Apprentice
Joined: 03 Feb 2018 Posts: 275
|
Posted: Thu Mar 01, 2018 3:02 am Post subject: |
|
|
pjp wrote: | I don't use cups. If it requires a separate package, then yes, it should have pulled something in.
Do you have any web servers installed? |
Nope, wonder how cups web ui works. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Thu Mar 01, 2018 4:13 am Post subject: |
|
|
Providing a server isn't necessarily that difficult (the trick is doing it well). It's just something they've built into the app. The back-end generates the "web page," the browser renders / displays it. (I'm guessing).
For example, you could -- but shouldn't unless you "know what you're doing" -- do this with python:
Code: | $ python -m http.server 8080 --bind 127.0.0.1
Serving HTTP on 127.0.0.1 port 8080 ...
127.0.0.1 - - [28/Feb/2018 22:09:52] "GET / HTTP/1.1" 200 - |
Code: | $ curl localhost:8080
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Directory listing for /</title>
</head>
<body>
<h1>Directory listing for /</h1>
<hr>
<ul>
</ul>
<hr>
</body>
</html> |
_________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Thu Mar 01, 2018 4:17 am Post subject: |
|
|
I don't use cups either, but I believe it used to contain its own web server. At any rate you probably don't want to mess with it.
I'd stick with apache2 or nginx. Compare features of them and see what appeals most. I've only ever used apache2, which can do pretty much anything. I've heard nginx is easier to configure, but apache2 is ready to go for basic stuff, only a small amount of configuration to get it working. |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30884 Location: here
|
Posted: Thu Mar 01, 2018 6:40 am Post subject: |
|
|
There is also www-servers/lighttpd _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Thu Mar 01, 2018 11:09 am Post subject: |
|
|
The_Document ... it depends a little on what you intend to serve, but if your needs are minimal then the following will suffice:
Code: | # mkdir -p /var/www/localhost
# busybox httpd -u nobody -p 127.0.0.1:80 -h /var/www/localhost
# netstat -plnt | grep ':80'
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 32471/busybox
# touch /var/www/localhost/index.html
# wget --spider localhost
Spider mode enabled. Check if remote file exists.
--2018-03-01 12:02:27-- http://localhost/
Resolving localhost... 127.0.0.1, 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 0 [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving. |
HTH & best ... khay |
|
Back to top |
|
|
cwr Veteran
Joined: 17 Dec 2005 Posts: 1969
|
Posted: Thu Mar 01, 2018 9:57 pm Post subject: |
|
|
I'd go with Lighttpd - I use it for a number of odd jobs, serving Mercurial projects and documentation
among them, and it's very easy to set up, a lot easier than Apache.
Will |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Thu Mar 01, 2018 10:45 pm Post subject: |
|
|
It's not really a good idea to recommend a specific web server without knowing something of the nature of the material being served.
If it's all static content, then the lightest and simplest option will likely be a good choice.
If it's going to link to some sort of web application then the correct choice depends on what language the webapp is written in. For example, if you're using Java-based wars you might consider Apache Tomcat. If you're using PHP then you might consider nginx or apache2.
I could go on but would rather not fill up the thread with useless junk. |
|
Back to top |
|
|
|