Help with Virtual Host
Added by nokia3310 over 12 years ago
CentOS 6.3 64 bit
Lighttpd 1.4.31
i have tried all i can to setup virtual host on my machine and haven't been successful. I have gone through the docu/wiki page on lighttpd and haven;t been successful. I have even gone to serverfault http://serverfault.com/questions/462023/lighttpd-virtual-hosting-configuration/462133#462133 and on webhostingtalk http://www.webhostingtalk.com/showthread.php?t=1222205
So please help me..i believe setting up virtual host is not something difficult to explain but for some reason lighttpd has failed to do that...just the truth here.
I have done it in minutes with apache and nginx as a newbie and with lighttpd..its weeks now and stiull can't figure it out.
Please help.
Replies (7)
RE: Help with Virtual Host - Added by patrickdk over 12 years ago
Not sure what your asking for, it's documented, and you didn't list any problems or issues, just saying, lighttpd is broken. Maybe explain or say what it is your attempting?
As far as virtual hosting goes, it's dead simple, you just add a HTTP["host"] conditional, and that is all you need.
Or maybe you want to do it via ip address instead, then use the SERVER["SOCKET"] conditional instead.
RE: Help with Virtual Host - Added by nokia3310 over 12 years ago
For crying out loud patrick i even enter 2 urls...didn't you see the urls? i mean i have been all over the internet saying what my issue is..its just cumbersome starting all over again.
Lets just say assume i just downloaded lighttpd and i have default conf files...what do i go from there.
And if you mention its documented on lighttpd website well why haven't i or several other people who tried to help didn't figure it out?
RE: Help with Virtual Host - Added by nokia3310 over 12 years ago
patrickdk wrote:
Not sure what your asking for, it's documented, and you didn't list any problems or issues, just saying, lighttpd is broken. Maybe explain or say what it is your attempting?
As far as virtual hosting goes, it's dead simple, you just add a HTTP["host"] conditional, and that is all you need.
Or maybe you want to do it via ip address instead, then use the SERVER["SOCKET"] conditional instead.
Ok here is the deal...i have 3 websites i want to setup i have web1.com, web2.com and web3.com. I want to setup URL redirect from www to non-www for these websites.
Here is what i have:
$HTTP["host"] =~ "^www\.(.*)$" { url.redirect-code = 301 url.redirect = ( "/(.*)" => "http://%1/$1" ) } $HTTP["host"] == "www.web1.com" { #url.redirect = ( # "^/(.*)" => "http://web1.com/$1", # ) server.document-root = "/var/www/web1.com/public_html" # accesslog.filename = "/var/www/web1.com/logs/error.log" } $HTTP["host"] == "web2.com" { server.document-root = "/var/www/web2.com/public_html" # accesslog.filename = "/var/www/web2.com/logs/error.log" } $HTTP["host"] == "web3.com" { server.document-root = "/var/www/web3.com/public_html" # accesslog.filename = "/var/www/web3.com/logs/error.log" }
Now with the above configuration...i have php-fpm installed...i followed the guide from http://www.howtoforge.com/installing-lighttpd-with-php5-php-fpm-and-mysql-support-on-centos-6.3 and i have wordpress installed on web3.com. Now with the configuration i receive errors 500 and 503 when on web3.com. Now for the redirect...the redirect is not working well, so is that the right way?
RE: Help with Virtual Host - Added by patrickdk over 12 years ago
See, you keep limiting your configuration, the config you post by itself is correct, therefor the stuff your not posting is causing an issue, Since you refuse to post it, and didn't post it in any of the other urls, I really can't help you at all.
RE: Help with Virtual Host - Added by nokia3310 over 12 years ago
the config i post is all i added to the default lighttpd.conf file.
And as i said...the redirecting is working the wrong way..instead of redirecting to non-www...it is rather going to www
also the wordpress is not working...is this anything to do with using php-fpm? As i said i gave url i followed to setup php-fpm http://www.howtoforge.com/installing-lighttpd-with-php5-php-fpm-and-mysql-support-on-centos-6.3
So what do you want me to post now?
RE: Help with Virtual Host - Added by patrickdk over 12 years ago
Well, if you didn't want the www, then you need to remove the www from your match of www.web1.com, as it overrides the previous block that does the redirect.
ask the php people about wordpress?