VectorLinux

The nuts and bolts => Web & Internet => Topic started by: MarkGrieveson on September 23, 2012, 03:55:48 pm

Title: [solved] lighttpd
Post by: MarkGrieveson on September 23, 2012, 03:55:48 pm
I installed lighttpd but I can't seem to start it.  I've checked /var/www/htdocs-lighttpd, where I put both a test index.html and then a test index.php file, but it just shows the files, rather than projecting the webpage.  Is there a command to start the server?  I've also tried connecting to the localhost:80, but it tells me that "Firefox can't establish a connection to the server at localhost."  
Title: Re: lighttpd
Post by: MarkGrieveson on September 23, 2012, 04:51:53 pm
Tried to start it, but got the following feedback:

Code: [Select]
root:# /etc/rc.d/rc.lighttpd start
Starting lighttpd: /usr/sbin/lighttpd
2012-09-23 20:10:39: (server.c.782) can't find username lighttpd

So, I'm not sure what to do now.  Suggestions?
Title: Re: lighttpd
Post by: MarkGrieveson on September 23, 2012, 05:16:54 pm
Okay, I think I got it started, anyway (which I suppose is something).

Code: [Select]
root:# /etc/rc.d/rc.lighttpd start
Starting lighttpd: /usr/sbin/lighttpd
Already running!

To address the issue I raised in post #2, I commented out the the user and group designation of "lighttpd".  So, it did start, but it gave me a 403 error, saying that I was forbidden to view it.  Here are the changes I made to /etc/lighttpd/lighttpd.conf (basically I just commented out the server.username and server.groupname):

Code: [Select]
## change uid to <uid> (default: don't care)
#change by Mark
#server.username            = "lighttpd"


## change uid to <uid> (default: don't care)
#20120923 change by Mark:
#server.groupname           = "lighttpd"

So, that's not going to work.  Any idea how I can properly add the user and group "lighttpd"?  Any idea why the installation of lighttpd didn't already do this if it's a requirement of running the program?
Title: Re: lighttpd
Post by: hata_ph on September 23, 2012, 05:24:14 pm
show us your /etc/passwd and /etc/group

EDIT:

Run below command as root to manually add lighttpd user

Quote
groupadd -g 208 lighttpd
useradd -u 208 -g lighttpd -d /var/www lighttpd
Title: Re: lighttpd
Post by: MarkGrieveson on September 23, 2012, 05:45:53 pm
Thanks hata_ph, that's great.  I changed the conf file back to how it had been previously, and it started without complaint this time.  So, progress.  However, I still get a 403 error.  There must be permission issues with the root directory, that being with /var/www/htdocs-lighttpd.  Should I "chmod 0755" this directory and those that lead to it (and its contents)?

PS, here is my /etc/group and /etc/passwd, as requested:

Code: [Select]
root:x:0:root
bin:x:1:root,bin
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root,adm,mark
lp:x:7:lp,mark
mem:x:8:
kmem:x:9:
wheel:x:10:root
floppy:x:11:mark
mail:x:12:mail
news:x:13:news
uucp:x:14:uucp
man:x:15:
dialout:x:16:uucp,mark
audio:x:17:mark
video:x:18:mark
cdrom:x:19:mark
games:x:20:mark
slocate:x:21:mark
utmp:x:22:
smmsp:x:25:smmsp
tape:x:26:
mysql:x:27:
rpc:x:32:
sshd:x:33:sshd
gdm:x:42:
shadow:x:43:
ftp:x:50:
oprofile:x:51:
apache:x:80:
messagebus:x:81:
haldaemon:x:82:
plugdev:x:83:mark
power:x:84:mark
netdev:x:86:mark
pop:x:90:pop
scanner:x:93:mark
nobody:x:98:nobody
nogroup:x:99:
users:x:100:mark
console:x:101:
lock:x:120:
burning:x:121:
mark:x:1000:
avahi:x:214:
lighttpd:x:208:

Code: [Select]

  GNU nano 2.3.0                    File: /etc/passwd                                               

root:x:0:0::/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/log:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/:/bin/false
news:x:9:13:news:/usr/lib/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
operator:x:11:0:operator:/root:/bin/bash
games:x:12:100:games:/usr/games:/bin/false
ftp:x:14:50::/home/ftp:/bin/false
smmsp:x:25:25:smmsp:/var/spool/clientmqueue:/bin/false
mysql:x:27:27:MySQL:/var/lib/mysql:/bin/false
rpc:x:32:32:RPC portmap user:/:/bin/false
sshd:x:33:33:sshd:/:/bin/false
gdm:x:42:42:GDM:/var/lib/gdm:/bin/false
oprofile:x:51:51:oprofile:/:/bin/false
apache:x:80:80:User for Apache:/srv/httpd:/bin/false
messagebus:x:81:81:User for D-BUS:/var/run/dbus:/bin/false
haldaemon:x:82:82:User for HAL:/var/run/hald:/bin/false
pop:x:90:90:POP:/:/bin/false
nobody:x:99:99:nobody:/:/bin/false
mark:x:1000:1000:Mark Grieveson:/home/mark:/bin/bash
avahi:x:214:214:Avahi User:/dev/null:/bin/false
lighttpd:x:208:208::/var/www:
Title: Re: lighttpd
Post by: hata_ph on September 23, 2012, 09:55:00 pm
show us the permission of /var/www
Title: Re: lighttpd
Post by: MarkGrieveson on September 23, 2012, 11:11:38 pm
I put the contents of the unpacked friendica source within it, since I was interested in trying to get that working.  Anyway, here's the permissions:

Code: [Select]
drwxr-xr-x 15 root root 4096 Sep 23 21:17 www/
And here's the contents permissions:

Code: [Select]
vector://var
mark:$ ls -l www
total 244
-rwxr-xr-x  1 root root 12000 Sep 23 18:05 INSTALL.txt*
-rwxr-xr-x  1 root root  1091 Sep 23 18:05 LICENSE*
-rwxr-xr-x  1 root root   582 Sep 23 18:05 README*
-rwxr-xr-x  1 root root 50052 Sep 23 18:05 boot.php*
-rwxr-xr-x  1 root root  2519 Sep 23 18:05 build.xml*
-rwxr-xr-x  1 root root   571 Sep 23 18:05 convert_innodb.sql*
-rwxr-xr-x  1 root root 32249 Sep 23 18:05 database.sql*
drwxr-xr-x  2 root root  4096 Sep 23 18:05 doc/
-rwxr-xr-x  1 root root   234 Sep 23 18:05 docblox.dist.xml*
-rwxr-xr-x  1 root root  3202 Sep 23 18:05 htconfig.php*
drwxr-xr-x  2 root root  4096 Sep 23 21:17 htdocs-lighttpd/
drwxr-xr-x  3 root root  4096 Sep 23 18:05 images/
drwxr-xr-x  3 root root  4096 Sep 23 18:05 include/
-rwxr-xr-x  1 mark mark   713 Sep 23 19:07 index.html*
-rwxr-xr-x  1 root root 10260 Sep 23 18:06 index.php*
drwxr-xr-x  2 root root  4096 Sep 23 18:05 js/
drwxr-xr-x 19 root root  4096 Sep 23 18:05 library/
drwxr-xr-x  2 root root  4096 Sep 23 18:05 mod/
drwxr-xr-x  2 root root  4096 Sep 23 18:05 mods/
drwxr-xr-x  2 root root  4096 Sep 23 18:05 object/
drwxr-xr-x  2 root root  4096 Sep 23 18:05 spec/
-rwxr-xr-x  1 root root   516 Sep 23 18:05 testargs.php*
drwxr-xr-x  2 root root  4096 Sep 23 18:05 tests/
-rwxr-xr-x  1 root root 40899 Sep 23 18:05 update.php*
drwxr-xr-x  3 root root  4096 Sep 23 18:05 util/
drwxr-xr-x 14 root root 12288 Sep 23 18:05 view/
vector://var
mark:$
Title: Re: lighttpd
Post by: MarkGrieveson on September 24, 2012, 08:47:40 am
Okay, I did get it working.  Turns out that I had an "index.php" file there, and currently on my system lighttpd is not set to use php.  So, I removed this file, and created simply an "index.html" file, and this worked.  It was not forbidden.  

Now the trick will be getting cgi and php working.  I had another thread on that a while ago, so I'll mark this as solved, since lighttpd is now working, and go to the other thread (http://forum.vectorlinux.com/index.php?topic=16649.0) to work on enhancements to the webserver.  Thanks again for your help, hata_ph.
Title: Re: [solved] lighttpd
Post by: hata_ph on September 24, 2012, 07:16:43 pm
glad to help