the website is served
server_name www.yourdomain.com; #names the server using the www
prefix
#if a server request is made without www, this next line will
rewrite it
rewrite ^/(.*) http://yourdomain.com/$1 permanent;
}
#this second server module tells Nginx where to find the files when
requested
server {
listen 80; #sets the HTTP port from which
the website is served
server_name yourdomain.com; #names the server being
configured
root /home/<yourusername>/public_html/yourdomain.com/; #top
directory for the site
index index.html index.php;
client_max_body_size 1G;
fastcgi_buffers 64 4K;
location / { #sets the location of the files
being served
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Restart Nginx, and you are all set. See http://wiki.nginx.org/PHPFcgiExample
for more details.
Adding and Configuring Modules
The topic of adding and configuring modules is bigger than can or should be
covered in this book, where we only intend to introduce and help you acquire
a basic competence with a wide range of technologies and features available
in/with/for Ubuntu. In this chapter, we have only set up a basic server. It will
serve the needs of most people, but there are tons of other settings available
for you to use, and there are many other configuration options for core
modules and even optional modules you can add to your server.
Adding additional modules is something that must be done when Nginx is
compiled, so if you need something that is not included by default in the
package from the Ubuntu repositories, you need to read the official