Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
04-11-2011, 07:41 AM
|
#1
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Rep:
|
lighttpd - setup virtual hosting question
Hi folks,
host - ubuntu 1010 desktop 64bit
virtualizer - Orcle VirtualBox
VM (guest) - ubuntu 1010 server 64.
Lighttpd is now running on the guest. On host browser evoking ip_address (intranet address) starts the webpage
Then I followed;
Lighttpd virtualhost configuration ~ name-based virtual hosting
How do I configure Lighttpd for name-based virtual hosting?
http://www.cyberciti.biz/faq/howto-l...configuration/
to setup virtual hosting. All steps went through without complaint except the last step:
$ sudo chown -R lighttpd:lighttpd /home/lighttpd/
[sudo] password for satimis:
Code:
chown: invalid user: `lighttpd:lighttpd'
$ sudo chown -R data-www:data-www /home/lighttpd
Code:
chown: invalid user: `data-www:data-www'
Please help. TIA
B.R.
satimis
|
|
|
04-11-2011, 08:36 AM
|
#2
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
Quote:
sudo chown -R data-www:data-www /home/lighttpd
Code:
chown: invalid user: `data-www:data-www'
|
It should be www-data:www-data not the other way around
|
|
|
04-11-2011, 09:13 AM
|
#3
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
It should be www-data:www-data not the other way around
|
Hi,
I see. Sorry I made a mistake. I got it done.
Why lighttpd:lighttpd didn't work?
A further question where shall I keep "index.html" file? TIA
B.R.
satimis
|
|
|
04-11-2011, 09:40 AM
|
#4
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
Quote:
Why lighttpd:lighttpd didn't work?
|
That is because there is no lighttpd user and group in ubuntu. The default user and group in your distro is www-data for both
Quote:
A further question where shall I keep "index.html" file?
|
Since you're configuring virtual hosts, there should be an index.html in every virtual host's docroot (i.e. the directory you define with server.document-root=..)
|
|
|
04-11-2011, 10:02 AM
|
#5
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
- snip -
Since you're configuring virtual hosts, there should be an index.html in every virtual host's docroot (i.e. the directory you define with server.document-root=..)
|
Thanks. I'll come back to this later.
Now I encounter another problem on connecting the public IP.
On /etc/lighttpd/lighttpd.conf
If
Code:
server.port = 80
server.bind = "local IP"(Intranet)
$ sudo /etc/init.d/lighttpd restart
works without problem
If
Code:
server.port = 80
server.bind = "public IP'
$ sudo /etc/init.d/lighttpd restart
[sudo] password for satimis:
Code:
* Stopping web server lighttpd [ OK ]
Syntax OK
* Starting web server lighttpd 2011-04-11 21:42:01: (network.c.345) can't bind to
port: xxx.xxx.xxx.xxx 80 Cannot assign requested address
[fail]
ports 80 and 8080 have been forwarded to this VM
$ lsof -i :80
No output.
Any advice. TIA
B.R.
satimis
|
|
|
04-11-2011, 12:01 PM
|
#6
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
You cannot make a server listen on an IP that is not present on your system. Public IP is the IP of your router, not your ubuntu box.
So leave the server.bind commented out, or use
If your forwarding works, then when someone hits xxx.xxx.xxx.xxx:80, he will be forwarded to your lighttpd server
Regards
|
|
|
04-11-2011, 12:47 PM
|
#7
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
You cannot make a server listen on an IP that is not present on your system. Public IP is the IP of your router, not your ubuntu box.
So leave the server.bind commented out, or use
If your forwarding works, then when someone hits xxx.xxx.xxx.xxx:80, he will be forwarded to your lighttpd server
|
Changing:
server.bind = "public_IP"
back to:
server.bind = "local_IP"
$ sudo /etc/init.d/lighttpd restart
Code:
* Stopping web server lighttpd [ OK ]
Syntax OK
* Starting web server lighttpd [ OK ]
Now it works. Thanks
$ sudo cp /var/www/index.html /home/lighttpd/satimis.com/http/index.html
$ sudo cp /var/www/index.html /home/lighttpd/default/http/index.html
$ sudo rm /var/www/index.html
On host's browser starts the the first webpage.
However I can't resolve it needs 2 "index.html" files. If deleting /home/lighttpd/default/http/index.html it can't work.
B.R.
satimis
Edit:
I must keep;
/var/www/index.html
Otherwise it can't work. Why it needs 3 identical files
Last edited by satimis; 04-11-2011 at 12:58 PM.
|
|
|
04-11-2011, 01:08 PM
|
#8
|
Member
Registered: Sep 2007
Location: Poland
Distribution: Ubuntu LTS
Posts: 105
Rep:
|
Quote:
Originally Posted by satimis
$ sudo cp /var/www/index.html /home/lighttpd/satimis.com/http/index.html
$ sudo cp /var/www/index.html /home/lighttpd/default/http/index.html
$ sudo rm /var/www/index.html
On host's browser starts the the first webpage.
However I can't resolve it needs 2 "index.html" files. If deleting /home/lighttpd/default/http/index.html it can't work.
|
Because http://public_IP does not get redirected to satimis.com/http/index.html and falls back to default home page /var/www/index.html. When you reference your server by IP it cannot guess which virtual host you want (normally, you have many virtual hosts on single IP).
You might try http://<some_testing_hostname>.satimis.com if you have DNS set up for your particular configuration.
You can easily set one virtual host as default to get rid of extra index.html files.
|
|
|
04-11-2011, 09:46 PM
|
#9
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Hi dr_agon,
Thanks for your advice.
Quote:
Originally Posted by dr_agon
- snip -
You might try http://<some_testing_hostname>.satimis.com if you have DNS set up for your particular configuration.
|
I don't run DNS server, using Service-Provider's DNS instead.
Whether you meant subdomain? I'll add them for testing later. What about other domain? e.g.aaa.com, bbb.com etc. Would the steps creating them the same? Thanks.
Quote:
You can easily set one virtual host as default to get rid of extra index.html files.
|
Could you please explain in detail? Thanks
A side question:
OS - Ubuntu 1010 server edition
lighttpd won't start at boot. I must run
Code:
# etc/init.d/lighttpd start
to evoke it.
Shall I add
Code:
/etc/rc.d/init.d/lighttpd start
on /etc/rc.d/rc.local file? Or there is a lighttpd way?
B.R.
satimis
|
|
|
04-12-2011, 03:15 AM
|
#10
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
Quote:
Shall I add
Code:
/etc/rc.d/init.d/lighttpd start
on /etc/rc.d/rc.local file? Or there is a lighttpd way?
|
The ubuntu way is to run:
Code:
update-rc.d lighttpd defaults
Regards
|
|
|
04-12-2011, 08:15 AM
|
#11
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
The ubuntu way is to run:
Code:
update-rc.d lighttpd defaults
Regards
|
Hi,
It didn't work.
$ update-rc.d lighttpd defaults
Code:
System start/stop links for /etc/init.d/lighttpd already exist.
Died at /usr/sbin/update-rc.d line 57.
line 57
Code:
open(FILE, ">", "$archive/${script}.new") || die;
I found similar problem on Internet;
http://forum.lighttpd.net/topic/277
B.R.
satimis
|
|
|
04-12-2011, 08:38 AM
|
#12
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
You should run the update-rc.d script as root, or at least use sudo.
Anyway in your case it's not needed as the symlinks already exist. I guess they were created when you installed the lighttpd package.
Just check if the startup script is executable, because you said that lighttpd is not starting on boot:
Code:
sudo chmod +x /etc/init.d/lighttpd
|
|
|
04-12-2011, 12:39 PM
|
#13
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Quote:
Originally Posted by bathory
You should run the update-rc.d script as root, or at least use sudo.
Anyway in your case it's not needed as the symlinks already exist. I guess they were created when you installed the lighttpd package.
Just check if the startup script is executable, because you said that lighttpd is not starting on boot:
Code:
sudo chmod +x /etc/init.d/lighttpd
|
Something strange happens here.
# update-rc.d lighttpd defaults
Code:
System start/stop links for /etc/init.d/lighttpd already exist.
$ sudo chmod +x /etc/init.d/lighttpd
No printout
$ ls -al /etc/init.d/lighttpd
Code:
-rwxr-xr-x 1 root root 2519 2010-07-16 02:25 /etc/init.d/lighttpd
Rebooted OS. lighttpd can't be started at boot.
sudo nano /etc/rc.locat
adding following line
Code:
/etc/init.d/lighttpd start
Rebooted the OS, still unable to start lighttpd. I must start it manually running
$ sudo /etc/init.d/lighttpd start
Code:
[sudo] password for satimis:
Syntax OK
* Starting web server lighttpd [ OK ]
Edit:
$ sudo tail /var/log/lighttpd/error.log
Code:
2011-04-13 00:06:53: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)
2011-04-13 00:17:19: (server.c.1503) server stopped by UID = 0 PID = 1290
2011-04-13 00:19:20: (log.c.166) server started
2011-04-13 00:19:20: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)
2011-04-13 00:20:58: (server.c.1503) server stopped by UID = 0 PID = 1235
2011-04-13 00:22:25: (log.c.166) server started
2011-04-13 00:22:25: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)
2011-04-13 00:23:17: (server.c.1503) server stopped by UID = 0 PID = 1245
2011-04-13 00:29:02: (log.c.166) server started
2011-04-13 00:29:02: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)
satimis
Last edited by satimis; 04-12-2011 at 12:52 PM.
|
|
|
04-12-2011, 01:53 PM
|
#14
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,218
|
I cannot tell what's wrong with the update-rc.d script. Check /var/log/messages to see if you find something relevant.
Other things you can do is:
Remove the symlinks and recreate them:
Code:
update-rc.d -f lighttpd remove
update-rc.d lighttpd defaults
Check if /etc/rc.local is executable and use the following instead of "/etc/init.d/lighttpd start"
Code:
/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
Quote:
2011-04-13 00:06:53: (server.c.954) WARNING: unknown config-key: accesslog.filename (ignored)
|
This is also strange. The accesslog.filename option is defined in access_log.conf. What gives:
grep accesslog.filename /etc/lighttpd/lighttpd.conf
|
|
|
04-13-2011, 12:23 AM
|
#15
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
Solved
Hi bathory,
$ sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
Code:
2011-04-13 12:04:23: (configfile.c.1210) base-docroot doesn't exist: home/lighttpd/default/http/
2011-04-13 12:04:23: (server.c.613) setting default values failed
$ ls /home/lighttpd/default/http/ I sorted out the cause. on /etc/lighttpd/lighttpd.conf
leave the server.bind blank without adding any line here.
Now lighttpd starts at boot.
Thanks for your assistance.
B.R.
satimis
|
|
|
All times are GMT -5. The time now is 03:06 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|