Installing nginx with passenger and HttpUploadProgressModule...
Lately I've been tinkering with nginx, passenger and file upload progress and since some of my fellow programmers said they were having problems putting it all together I'll try and put here some of the steps I've taken to get it all working from scratch.
Get latest nginx (version 1.2.0):
$ curl -C - -O http://nginx.org/download/nginx-1.2.0.tar.gz
$ tar xzpvf nginx-1.2.0.tar.gz
Get Nginx HttpUploadProgressModule (version 0.9.0):
curl -L -o nginx-upload-progress.tar.gz https://github.com/masterzen/nginx-upload-progress-module/tarball/v0.9.0
tar xzpvf nginx-upload-progress.tar.gz
$ #If you're using rbenv don't forget to "rbenv rehash" afterwards
$ gem install passenger
$ cd nginx-1.2.0
$ export PREFIX= $ ./configure --add-module=../masterzen-nginx-upload-progress-module-82b35fc --add-module=`passenger-config --root`/ext/nginx --prefix=$PREFIX
$ make
$ make install
Check if everything's OK with:
Now go to your browser and go to localhost:80 and you'll shall see "Welcome to nginx!"
Here's a sample project for you to test this configuration.
Check the following sites for more on this:
http://wiki.nginx.org/HttpUploadProgressModule
https://github.com/masterzen/nginx-upload-progress-module
https://github.com/drogus/jquery-upload-progress
PS: If you get this error while running ./configure:
"./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre= option."
Then you just have to get libpcre and if you're using brew on Mac OSX then:
PS2: If you're getting something like:
... objs/ngx_modules.o \
/Users/pecarrico/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/passenger-3.0.12/ext/nginx/../common/libpassenger_common.a /Users/pecarrico/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/passenger-3.0.12/ext/nginx/../common/libboost_oxt.a -lstdc++ -lpthread -lm -lpcre -lcrypto -lcrypto -lz
Undefined symbols for architecture x86_64:
"_pcre_free_study", referenced from:
_ngx_pcre_free_studies in ngx_regex.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make: *** [build] Error 2
Add --with-ld-opt="-L /usr/local/lib" to the ./configure options (check http://trac.nginx.org/nginx/ticket/94 for more information).