如何在 Ubuntu 11.10 上安装 freepbx 2.9 和 asterisk 1.8?
问题是,互联网上的大多数教程和指南都写得不好,当我启动 amportal 时会收到错误消息。
另一个困难是,如果我使用 nginx/php-fpm,则没有指南。所有教程都是针对 Apache 的。
答案1
首先确保你的版本是最新的,安装 nginx、php-cli,然后安装 php-fpm/cgi。然后,编辑配置文件。配置文件显然可能完全不同,例如,如果你使用像 CodeIgniter 这样的框架;但我不认为 FreePBX 使用框架。
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
这是/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/*;
}
编辑 fastcgi_params 文件。
sudo vim /etc/nginx/fastcgi_params
这是/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;
编辑网站定义文件。
sudo vim /etc/nginx/sites-available/default
这是 /etc/nginx/sites-available/default 文件:
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;
}
}
创建网站根目录和默认文档。
sudo mkdir /var/www/public
sudo vim /var/www/public/index.php
这是 /var/www/public/index.php 文件:
<?php phpinfo() ?>
重新启动 nginx。
sudo /etc/init.d/nginx restart
在浏览器中加载该网站以查看它是否正常工作。在没有 GUI 的 Ubuntu 服务器上?
sudo apt-get install links
links http://www.example.com/
您应该看到 phpinfo() 的结果。
一旦看到 phpinfo() 工作正常,请按照编译说明对于星号。