Welcome! Log In Create A New Profile

Advanced

How to create setup like this

Posted by Chris 
How to create setup like this
July 20, 2009 10:13PM
Greetings nginx users!
I imagine that this setup is pretty basic but I would like to hear from someone how to do this correctly since I will be wiping our webserver and start off from scratch since I have decided to start using nginx instead of apache.

Basically, I have a website that has around 40.000 visitors a month, I know, this isn't much at all. But most of the website is static content and has loads of images and a big flash header in it. The images sizes goes up to 4mb each!

Here's an example of our current setup:
website is domain.ltd and all images/flash files are located in domain.ltd/img, gfx and user_images.

I've been googling and trying out nginx+php-fpm, is this something that I should use? or should I go on with nginx+fast-fcgi instead?
How would I go on with caching the img/gfx/user_images folders for best performance?
Is there a up-to-date guide of how to setup nginx with php-fpm/fast-fcgi for Debian Etch? My main problem is the nginx configuration file, I feel very lost when working with it and just can't figure out how to build it up to fit my setup -- so if anyone could post a configuration file that would seem to fit my needs then I'd be most greatful.

If you'd like to see the website I run you are most welcome to send me a pm about it so you can get an overview of what I might be needing :)
Re: How to create setup like this
July 21, 2009 02:46AM
how about you tell us what your currently working configuration is (.htaccess/rewrites, etc)

as for php you can use either php-fpm or php-cgi+spawner/manager (supervisord, god, daemontools, spawn_fcgi, etc)

as for caching, IIRC you don't need any special caching for static files (done by system)



Edited 1 time(s). Last edit at 07/21/2009 02:47AM by edogawaconan.
Re: How to create setup like this
July 21, 2009 01:27PM
Currently my .htaccess file is pretty much basic, I'm not worried about it.
Could you please show me an example of how I would go on with caching the img/gfx/user_images folders within the nginx.config file?

Also, would you prefere php-fpm before spawn-fcgi?
Re: How to create setup like this
July 21, 2009 08:13PM
Good news, I have installed nginx+php-fpm succesfully and everything is working as expected, splendid!
I do wonder though (this is the main reason I picked nginx) how do I cache my /img/, /gfx/, /user_images/ folders? Could someone explain to me how this would be done?

Currently I use;
location ~* ^.+\.(jpg|jpeg|gif|png)$ {
root /var/www/;
access_log off;
expires 30d;
}
}

But from what I've read this isn't caching at all, then what is it and how do I cache it properly?
I'm so eager to figure it out, can't wait! :-)
Re: How to create setup like this
July 22, 2009 01:48AM
Back again, with more success and knowledge!

Ok, right now I am running:
nginx as frontend webserver and apache as backend. My goal is to let nginx serve and cache all the images for a special amount of time, all image files should be cached for 30d and flash(swf) files for 1h.

Please do bare with me, I've been struggling all night to get this to work correctly but I'm not even sure if it's even setup properly. Things you should know:
Apache is running on port 8080 and has documentroot set to /var/www with a vhost pointing to one of my sites
PHP 5.3.0 (cli) (built: Jul 20 2009 16:46:22)
nginx version: nginx/0.8.6

Here are my config files, I would appreciate if you could look at them and point out any errors or mistakes. I might be totally off track here, I have no idea -- been trying a lot of different things for the past 15 hours:

http://www.nopaste.com/p/a9Fh5pzAib proxy.conf
http://www.nopaste.com/p/aik7sC5G5 nginx.conf
http://www.nopaste.com/p/a0m9013Fd sites-enabled/default

You can see the site live at: http://62.20.49.194

PS. I will be writing a blog post for future reference once I get this to work.
Re: How to create setup like this
July 24, 2009 06:18PM
I give up, too much hassle to get it to work.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready