Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How I can install freepbx 2.9 with asterisk 1.8 on ubuntu 11.10?

The matter is that most tutorials and guidelines on internet are not well written and I get error messages when I do amportal start.

An extra difficulty is that there are no guidelines in case I use nginx/php-fpm. All tutorials are for apache.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

First make sure you are up to date, install nginx, php-cli, and then php-fpm/cgi. Afterward, edit config files. The config files obviously can be quite different, for example, if you are using a framework like CodeIgniter; but I don't think FreePBX uses a framework.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install php5-cli
sudo apt-get install php5-fpm php5-cgi
sudo vim /etc/nginx/nginx.conf

Here is /etc/nginx/nginx.conf:

# There are many more options to tweak nginx... bare bones follows:
user www-data;
worker_processes 4; # max_clients = worker_processes * worker_connections
worker_rlimit_nofile 8192; # file descriptors are > than worker_connections
events {
    worker_connections 8000; # provide (8000 * cpu_cores) connections
}
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # Define access log format.
    log_format main '$remote_addr - $remote_user [$time_local] $status '
            '"$request" $body_bytes_sent "$http_referer" '
            '"$http_user_agent" "$http_x_forwarded_for"';
    access_log /var/log/nginx/access.log;

    keepalive_timeout 20;
    sendfile on; # Send static files with nginx.

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

Edit the fastcgi_params file.

sudo vim /etc/nginx/fastcgi_params

Here is /etc/nginx/fastcgi_params:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# Enable PHP $_SERVER['HTTPS'] variable (will equal TLSv1, not "on")
fastcgi_param HTTPS $ssl_protocol;

Edit the website definition file.

sudo vim /etc/nginx/sites-available/default

Here is the /etc/nginx/sites-available/default file:

server {
    listen 80;
    server_name www.example.com;
    charset utf-8;

    # http://www.chromium.org/developers/how-tos/chrome-frame-getting-started
    add_header "X-UA-Compatible" "IE=Edge,chrome=1";

    location / {
        root   /var/www/public;
        index index.php;
    }

    # what to do with static files
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        access_log off;
        expires 30d;
        root /var/www/public;
    }

    # what to do with php files
    location ~ .php$ {
        fastcgi_index     index.php;
        include           /etc/nginx/fastcgi_params;
        keepalive_timeout 0;
        fastcgi_param     SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass      127.0.0.1:9000;

    }
}

Create the website root directory and default document.

sudo mkdir /var/www/public
sudo vim /var/www/public/index.php

Here is the /var/www/public/index.php file:

<?php phpinfo() ?>

Restart nginx.

sudo /etc/init.d/nginx restart

Load the site in a browser to see if it is working. On Ubuntu server with no GUI?

sudo apt-get install links
links http://www.example.com/

You should see the result of phpinfo().

Once you see phpinfo() working, follow the compilation instructions for Asterisk.

share|improve this answer
add comment

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.