VectorLinux
December 20, 2014, 05:18:10 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1] 2
  Print  
Author Topic: [solved] home webserver  (Read 4894 times)
MarkGrieveson
Vectorian
****
Posts: 531


« on: August 06, 2012, 01:46:32 pm »

Hello.  I used to run a home webserver with apache using Debian years ago.  I'm thinking of doing the same with Vector now.  I notice that apache is not a part of Gslapt, so I'm thinking of using lighttpd.  However, I'm wondering if it is possible to run a full LAMP-like (interactive) site with it.  So, can perl or php or python aspects be woven into the site using lighttpd, along with database stuff like mysql?
« Last Edit: February 22, 2013, 09:58:55 am by MarkGrieveson » Logged

I am using VL7.0 standard with XFCE
rbistolfi
Packager
Vectorian
****
Posts: 2291


« Reply #1 on: August 14, 2012, 03:16:22 pm »

Hi Mark,

Sorry to get so late into this one. Lighttpd can run dynamic code through cgi. If you tell us more about your requirements we can start building the tools you need, we usually have several HTTP daemons in the repo, but looks like they are late to the party this time.

Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
M0E-lnx
Administrator
Vectorian
*****
Posts: 3195



« Reply #2 on: August 14, 2012, 03:47:58 pm »

I run lighttpd but never used it for anything other than straight http.  Nothing interactive.
Logged

MarkGrieveson
Vectorian
****
Posts: 531


« Reply #3 on: August 16, 2012, 06:40:02 am »

That's great rbistolfi.  I'll check back in as I start creating a website.
Logged

I am using VL7.0 standard with XFCE
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #4 on: September 24, 2012, 08:20:03 am »

Okay, I'm back.  I got lighttpd working, so it can now serve up simple html.  However, I can't get it to do php.  I did install php from slackfind.net (php version 5.3.6-i486-6), but when I tested an "index.php" page on the server, it stated that it was "403 Forbidden".  

I think I need fastcgi first, which I can't find on Gslapt.  ....

Hmm, after perusing the net with good ol' DuckDuckGo, I found some information.  So, since I have php installed, I tried the following:

Code:
mark:$ php -v
php: error while loading shared libraries: libmcrypt.so.4: cannot open shared object file: No such file or directory
vector:/~
mark:$

Seems I need libmcrypt installed.  So, I did install this from Gslapt (libmcrypt version 2.5.8-i586-1vl70).  So, after testing, I see that php is primed to work:

Code:
mark:$ php -v
PHP 5.3.6 (cli) (built: Apr 14 2011 14:58:35)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

There's no starter file that I can find in /etc/rc.d, so that doesn't seem to be it.  Anyway, I found a page with some possible clues at the Arch wiki and at this other site, so I'll try some suggestions from there and report back -- I don't need to make a diary of every effort I make here, I figure.

Anyway, if anyone else has any helpful hints or can give me some useful url referrals (aka links), then please do so.
« Last Edit: September 24, 2012, 08:24:49 am by MarkGrieveson » Logged

I am using VL7.0 standard with XFCE
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #5 on: September 24, 2012, 08:45:33 am »

Okay, the aforementioned "other site" was helpful, so I now have basic php working (or fastcgi -- I'm not sure if I'm using the right lingo here).  Anyway, rather than a 403 Forbidden message at localhost, I did get a page.  The php file I was trying to get the localhost to show was from the Friendica folks (it's an opensource social networking application similar to Facebook).  Anyway, the page did appear, but it's given me various other errors.  See image attachment below.  If anyone has any suggestions for what I can do to overcome some of the issues pointed out in the image, do please share. 

Also, I wonder how to serve two different websites from the one home webserver (IE, have two different document-roots).  I've done this before many years ago with apache, but I can't recall how I did this -- and I figure it may be different on lighttpd anyway.  All suggestions welcome.

Logged

I am using VL7.0 standard with XFCE
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #6 on: September 24, 2012, 09:11:19 am »

Ugh.  In trying to get the OpenSSL module going, I modified the lighttpd.conf to enable those modules, and then restarted lighttpd, which gave the following error:

Code:
2012-09-24 13:21:53: (network.c.755) SSL: Private key does not match the certificate public key, reason: error:02001002:system library:fopen:No such file or directory server.pem
vector://home/mark

Well, I went through the process described here, and created a "server.pem" file, and then was able to enable the modules in lighttpd.conf, but still no luck.  The resulting window from the index.php file still reads "OpenSSL PHP module (required)".  I must be missing something.

« Last Edit: September 24, 2012, 09:58:23 am by MarkGrieveson » Logged

I am using VL7.0 standard with XFCE
|nic|
Packager
Vectorite
****
Posts: 162



WWW
« Reply #7 on: September 24, 2012, 09:39:36 pm »

Hi MarkGrieveson,

I can't help u with lighttpd, but maybe u can try the following installation.
It's xammp and it's an alternative to lampp.
Here's the link:

http://www.apachefriends.org/en/xampp-linux.html

greets,

nicdm
Logged

registered user #393337

Desktop AMD E6 / 8 gb ram / 120 GB SSD / 500 gb HD / VL7

Samsung NP110 / VL7.1 Std
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #8 on: October 03, 2012, 09:17:05 am »

Hi nicdm.  Thanks for the XAMPP link.  I'll take a look at that in the future.

At the moment, I'm trying to figure out my firewall.  For the domain I bought I used the company's "Advanced DNS Settings page" to point the domain name to my static IP.  However, while lighttpd is serving the small test page (index.html) I set up in /var/www/htdocs-lighttpd (the documentRoot) to my localhost, I am not getting it through the internet via the domain name.

So, I suspect the firewall is blocking it.  I used to use Guarddog back when I ran a home web server years ago, but it no longer seems to be developed.  Currently, my firewall is set through the pppoe-setup script (which gives three options:  NONE, STANDALONE, or MASQUERADE).  Mine is set for STANDALONE, which, according to Shields Up, keeps all the ports as "stealth".  I tried redoing this to NONE, which changed the status of some of the ports to "closed" rather than "stealth" (none were actually open).  This was the same case using vasm.  So, even then I could not access my site through the internet via my domain name.

I figure I would have to have either port 80 or port 8080 open to have a web server, but so far I'm not sure how to approach it.  I tried gufw, and couldn't figure it out (compared to guarddog, it seems so dumbed down as to be useless).

So, any recommendations will be appreciated.
Logged

I am using VL7.0 standard with XFCE
rbistolfi
Packager
Vectorian
****
Posts: 2291


« Reply #9 on: October 03, 2012, 10:15:51 am »

First thing I would do is to check your ports with nmap:

Code:
$ nmap <yourip>

That will list your ports and label them with "open", meaning that the port is accessible and a service is listening on it, "closed" meaning that the port is accesible but no service is listening and "filtered", meaning that the firewall is blocking the port.
How do you connect to the internet? A modem? a router? Your box has a public IP?
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #10 on: October 03, 2012, 08:04:26 pm »

It states

Code:
All 1000 scanned ports on [ip-address] are closed

Nmap done: 1 IP address (1 host up) scanned in 2.24 seconds

I connect to the internet via pppoe with an OvisLink modem/router (it's an ethernet connection.)  I purchase the internet connection from the Toronto Freenet, who (I believe) get it from Teksavvy.
« Last Edit: October 03, 2012, 08:06:02 pm by MarkGrieveson » Logged

I am using VL7.0 standard with XFCE
rbistolfi
Packager
Vectorian
****
Posts: 2291


« Reply #11 on: October 04, 2012, 09:25:00 am »

Do you run pppoe locally or in the modem/router?
If you use the device as a router you will need to forward the desired ports to the computer running the httpd.
In this case your PC would have an IP like 10.0.0.2 or 192.168.0.2, your router has the public IP and it will forward requests to the specified ports to your computer. From the page you linked this is not the default behaivor.
If you connect using pppoe-setup from your Vector box using the device as a modem, you must be running a local firewall and you will have to open the ports. I use iptables like this:


Code:
# Set the INPUT policy to DROP:
iptables -P INPUT DROP

# Allow packets from connections related to established ones, packets
# from established ones, and packets from localhost:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT

# Allow new connections to TCP ports 80, 8080, and 443
iptables -A INPUT -p TCP -m multiport --dports 80,8080,443 -m state --state NEW -j ACCEPT

This works for me. What did you use to close your ports?
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #12 on: October 04, 2012, 04:08:20 pm »

Do you run pppoe locally or in the modem/router?
If you use the device as a router you will need to forward the desired ports to the computer running the httpd.
In this case your PC would have an IP like 10.0.0.2 or 192.168.0.2, your router has the public IP and it will forward requests to the specified ports to your computer. From the page you linked this is not the default behaivor.
If you connect using pppoe-setup from your Vector box using the device as a modem, you must be running a local firewall and you will have to open the ports. I use iptables like this:


Code:
# Set the INPUT policy to DROP:
iptables -P INPUT DROP

# Allow packets from connections related to established ones, packets
# from established ones, and packets from localhost:
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT

# Allow new connections to TCP ports 80, 8080, and 443
iptables -A INPUT -p TCP -m multiport --dports 80,8080,443 -m state --state NEW -j ACCEPT

This works for me. What did you use to close your ports?

I really appreciate your help rbistolfi.  Some of your questions I'm not entirely sure, but I'll make a few guesses.  First, whether I "run pppoe locally or in the modem/router", I believe I run it locally.  I set up the internet connection with "pppoe-setup" using a terminal within Vector, rather than accessing the modem (IE, via an IP address within the browser) and doing stuff like that.  So, I think I run pppoe locally.  I believe the firewall comes from the firewall options within "pppoe-setup" (though even when I choose "NONE" during the firewall options during the setup, there appears to be some closing of ports, which puzzles me a bit).

I get a different result when I try the nmap command with the localhost:

Code:
mark:$ nmap localhost

Starting Nmap 6.01 ( http://nmap.org ) at 2012-10-04 20:26 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0011s latency).
Not shown: 999 closed ports
PORT    STATE SERVICE
631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 0.34 seconds

So, perhaps I need to play with the file lighttpd.conf.  Also, I'll try your firewall code suggestions and report back.  Thanks again for the suggestions.  Hopefully I'm close to making some progress.
Logged

I am using VL7.0 standard with XFCE
MarkGrieveson
Vectorian
****
Posts: 531


« Reply #13 on: October 04, 2012, 05:57:49 pm »

Okay, it's working!  At least, it's working on my computer now.  From your advice about whether the device was a modem or router, I determined it was running as a modem, and that I needed to change the server.bind from the localhost to the static IP address I have within the lighttpd.conf file.  After I did that, I got the following result:

Code:
mark:$ nmap ***.***.***.***

Starting Nmap 6.01 ( http://nmap.org ) at 2012-10-04 21:57 EDT
Nmap scan report for ***-***-***-***.dsl.teksavvy.com (***.***.***.***)
Host is up (0.0013s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.38 seconds

And, I haven't had to mess with the firewall.  ShieldsUp still reports that everything is stealth.  So, good news all around.

Thanks again for your help.  I'm sure I'll be back as more questions arise.
« Last Edit: October 04, 2012, 06:03:27 pm by MarkGrieveson » Logged

I am using VL7.0 standard with XFCE
rbistolfi
Packager
Vectorian
****
Posts: 2291


« Reply #14 on: October 05, 2012, 11:05:23 am »

Glad you got it working.
Enjoy!
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!