blog.notmyidea.org/how-to-install-nginx-php-53-on-freebsd.html

69 lines
No EOL
2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="./theme/css/main.css" type="text/css" media="screen" charset="utf-8">
<link href="./feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Alexis' log ATOM Feed" />
<title>Alexis Métaireau</title>
</head>
<body>
<div id="top">
<p class="author"><a href="./about.html">Alexis Métaireau</a>'s thoughs</p>
<ul class="links">
<li><a href="."></a></li>
</ul>
</div>
<div class="content clear">
<h1>How to install NGINX + PHP 5.3 on FreeBSD.</h1>
<p class="date">Published on Sun 10 October 2010</p>
<p>I've not managed so far to get completely rid of php, so here's a simple
reminder about how to install php on NGINX, for FreeBSD. Nothing hard, but
that's worse to have the piece of configuration somewhere !</p>
<pre class="literal-block">
# update the ports
$ portsnap fetch update
# install php5 port
$ make config-recursive -C /usr/ports/lang/php5-extensions
$ make package-recursive -C /usr/ports/lang/php5-extensions
# install nginx
$ make config-recursive -C /usr/ports/www/nginx-devel
$ make package-recursive -C /usr/ports/www/nginx-devel
</pre>
<p>Now we have all the dependencies installed, we need to configure a bit the
server.</p>
<p>That's a simple thing in fact, but it could be good to have something that will
work without effort over time.</p>
<p>Here's a sample of my configuration:</p>
<pre class="literal-block">
server {
server_name ndd;
set $path /path/to/your/files;
root $path;
location / {
index index.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
}
location ~ .php$ {
fastcgi_param SCRIPT_FILENAME $path$fastcgi_script_name;
fastcgi_pass backend;
include fastcgi_params;
}
}
upstream backend {
server 127.0.0.1:9000;
}
</pre>
<p>And that's it !</p>
</div>
</body>
</html>