Since last time I install php-fpm in my freebsd box I still looking way to make virtualhost. I think its not easy to make vhost in nginx but I’m wrong 🙂
Just add :
server {
directive
}
will add new vhost.
Full sample from my vhost :
server { listen 80; server_name sandbox.digitalfusi.com; location / { index index.php index.html; root /usr/local/www/nginx/sandbox; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx/sandbox$fastcgi_script_name; include fastcgi_params; } }
another feature that I learn too is ‘autoindex’ since my friend need to list all files and directory if no index files exists.
For more fancy index I need to recompile it with fancyindex but I’m OK with it 🙂
Full sample of nginx.conf for two vhost with autouindex on and off can be download from here.