Project

General

Profile

[Solved] How to configure virtual hosts on /home/user/www directory?

Added by f1refa11 over 1 year ago

I wanted to configure a lightweight web server with several virtual hosts which i wanted to be in my /home/user/www directory(like /home/user/www/example.local) so i can access it easily, but as the result, lighttpd sends 403 request when accessing http:/localhost, and times out when trying to go to wanted virtual hosts.

1. I added myself to www-data group, and chown'd the /home/firefall/www folder recursively.
2. I used this tutorial to configure virtual hosts: https://www.itzgeek.com/how-tos/linux/how-to-setup-virtual-hosts-in-lighttpd-server.html.
3. Config: https://paste.lighttpd.net/EC#Nelk09E0RfbgtrgFczvoYnLt
4. Changed default server.document-root variable to "/home/user/www/fireworld.local/"
5. Tried enabling request logging - didn't worked - i didn't find them anywhere.

OS: Linux Ubuntu 23.04
Version: lighttpd/1.4.67
Browser: FireFox 118.0.2 from snap


Replies (5)

RE: How to configure virtual hosts on /home/user/www directory? - Added by gstrauss over 1 year ago

If you did not find logs under /var/log/lighttpd/, then check if that exists and if user www-data has permission to write there. Similarly, does /var/cache/lighttpd/uploads exist and is it writable by user www-data?

Check the directory path ls -ld /home/firefall You probably did not give user www-data permission to traverse this directory.
https://ubuntu.com/blog/private-home-directories-for-ubuntu-21-04

RE: [Solved] How to configure virtual hosts on /home/user/www directory? - Added by f1refa11 over 1 year ago

I decided it would be better to host the hosts in default /var/www/ folder. after a little configuration, localhost works, but virtual hosts times out :(
All i changed is:
1. changed virtual host path to /var/www/host.local(didn't worked)
2. server.document-root = "/var/www/html"(localhost works)

Maybe i'm trying to open the vhost in an unproper way? Now i'm trying via "http://host.local", and it doesn't work.

RE: [Solved] How to configure virtual hosts on /home/user/www directory? - Added by gstrauss over 1 year ago

but virtual hosts times out

That sounds like a DNS or name service problem/misconfiguration before requests reach lighttpd.

You might check your lighttpd access log to see if the request are reaching lighttpd.
You might test using a command line client, such as curl, as curl allows you to connect to localhost and pass -H "Host: my.virtual.host"

RE: [Solved] How to configure virtual hosts on /home/user/www directory? - Added by f1refa11 over 1 year ago

When i'm reaching http://host.local and it times out, access.log doesn't show the request.
When i tried "curl -H "Host: host.local" http://localhost", and it gave me 404 response, but the request didn't show up in the access.log.

That sounds like a DNS or name service problem/misconfiguration before requests reach lighttpd.

Is there a way to fix this?

RE: [Solved] How to configure virtual hosts on /home/user/www directory? - Added by gstrauss over 1 year ago

When i tried "curl -H "Host: host.local" http://localhost", and it gave me 404 response, but the request didn't show up in the access.log.

There are many possibilities why it did not show up in the access log: you may not have configured lighttpd to enable the access log. You may not have restarted lighttpd after changing the configuration. You may not have configured an appropriate server.document-root for "host.local". ...

That sounds like a DNS or name service problem/misconfiguration before requests reach lighttpd.

Is there a way to fix this?

There are many, and they are outside the scope of this forum, as they are not related to lighttpd configuration.

If you are having trouble with basic DNS and name services, then perhaps you're not yet ready to use virtual hosts.

Please consider trying one small thing at a time, get it working, and then build your config from there, continuing to add and test one feature at a time.


Your forum title: "How to configure virtual hosts on /home/user/www directory?" has been answered, and so this topic should be closed.
If you have not already, please read How to get support

    (1-5/5)