Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to use asynchronous IO on nginx on FreeBSD. I see lots of documentation on how to configure it or how to compile nginx with it.

However, I already have nginx installed so I need to re-compile nginx with aio enabled. The recompile part is what I don't know how to do.

I'm using the nginx (v0.7.67) port provided with FreeBSD 8.

Can anybody help me?

share|improve this question
    
What version of nginx do you use? –  Cucumber Feb 8 '13 at 8:58
    
The version of nginx I am using is 0.7.67 –  David Feb 12 '13 at 4:03

2 Answers 2

up vote 3 down vote accepted

First, you need to add AIO support to your FreeBSD. You can use two ways for do this. 1) Add "options VFS_AIO" and rebuild kernel. 2) Loaded AIO dynamically via loadable kernel module: kldload aio

Add this lines to config after that:

location /video/ {
    sendfile       off;
    aio            on;
    output_buffers 1 64k;
}

You can use sendfile for AIO:

location /video/ {
    sendfile       on;
    tcp_nopush     on;
    aio            sendfile;
}

Both variants will work.

share|improve this answer
2  
You can load AIO dynamically on boot by adding aio_load="YES" to /boot/loader.conf, easier than recompiling. You may also need to rebuild the nginx port with the "Enable file aio" option checked. –  USD Matt Feb 8 '13 at 9:14
1  
I thought AIO was enabled on FreeBSD 8 by default. I guess I was wrong. How can I check if AIO is enabled already or not on the kernel? –  David Feb 12 '13 at 4:06
    
I do need to rebuild the nginx port with the "Enable file aio" option checked. How do I do this? (This is my original question) –  David Feb 12 '13 at 4:07

The easiest way to enable nginx file aio support on FreeBSD is to install nginx via the ports tree and just select the FILE_AIO option in the dialog.

portsnap fetch extract
cd /usr/ports/www/nginx
make install clean

But if you want to compile it yourself, download the source, extract it and then:

./configure --with-file-aio
make install

(You need to run both portsnap and make install as root!)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.