The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Tutorial: Use lighttpd to serve images
Lighttpd is a small web server that can serve static files faster than Apache. Some people are not comfortable, or just can't make a full switch to lighttpd. This tutorial will show you how to setup lighttpd to serve your images while allowing Apache to continue taking care of everything else.
I am not going to go into detail on why or how it can do this. Search google for lighttpd reviews and benchmarks for more information. 1. install lighttpd. Follow the guide here: http://trac.lighttpd.net/trac/wiki/TutorialInstallation 2. edit /etc/lighttpd/lighttpd.conf (you have moved this file here during installation, if you followed the guide linked above) You want your lighttpd.conf to look something like this: Code:
server.document-root = "/opt/httpd/htdocs/forums/images" server.port = 2747 server.bind = "localhost" mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png", ".gif" => "image/gif" ) Change server.document-root to the full path to your forum's images directory. Change server.port to a non standard port. I used 2747 in the example above. 3. Open your apache config file (httpd.conf) and make sure the following modules are enabled: Code:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so Code:
ProxyRequests Off ProxyPreserveHost On ProxyPass /forums/images http://localhost:2747/ ProxyPassReverse /forums/images http://localhost:2747/ If you ARE using virtual hosting, add the above to the <VirtualHost> tag that your forum site is in. This will either be in your httpd.conf, or a separate file such as httpd-vhosts.conf And that is it! Now, start light httpd with: /usr/local/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf And reload apache. Note: It is important to make sure that lighttpd starts before apache does so mod_proxy can do it's work. If you start apache first, and then lighttpd, you will get 404 errors for your images. |
#2
|
|||
|
|||
Is it worth proxying the requests through apache? O_o Doesn't that kinda defeat the point.
|
#3
|
|||
|
|||
I was wondering the same thing myself. I use lighttpd on my sites but I serve from a separate IP linked to images.whatever.com. I used to serve from the same IP but on a higher port (8080) but I had users complaining that the images were blocked when they were behind certain proxies or firewalls.
|
#4
|
|||
|
|||
Yeah I guess subdomain if you want to run lighttpd/apache, but try to run lighttpd only...for the php too....
|
#5
|
|||
|
|||
Thank you for the tutorial. Do you need to change anything in your templates and styles?
|
#6
|
|||
|
|||
anyone have an answer to this? Was interested in either using lighty only or apache + lighty; don't have my new server to play with yet.
|
#7
|
|||
|
|||
noobie question. Do we have to change anything in the styles (like url) ?
|
#8
|
|||
|
|||
Quote:
Code:
ProxyRequests Off ProxyPreserveHost On ProxyPass /forums/images http://localhost:2747/ ProxyPassReverse /forums/images http://localhost:2747/ |
#9
|
|||
|
|||
I'd like to use it to serve images from /forum/albums*, /forum/customavatars, /forum/customprofilepics too - is that doable?
Also what format are album images stored in? looking at the dir I see "1631.picture" etc listed not 1631.jpg etc listed Thanks in advance --------------- Added [DATE]1233617274[/DATE] at [TIME]1233617274[/TIME] --------------- I'm going to use: Code:
server.document-root = "/opt/httpd/htdocs/forum/" Code:
ProxyRequests Off ProxyPreserveHost On ProxyPass /forum/images http://localhost/images:2747/ ProxyPassReverse /forum/images http://localhost/images:2747/ ProxyPass /forum/customavatars http://localhost/customavatars:2747/ ProxyPassReverse /forum/customavatars http://localhost/customavatars:2747/ I'll edit this again when I get it working properly |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|