Home  >  Article  >  php教程  >  Ubuntu8.04快速搭建nginx+php系统

Ubuntu8.04快速搭建nginx+php系统

WBOY
WBOYOriginal
2016-06-06 19:55:261204browse

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 昨天在FreeBSD下玩了nginx+php,今天到ubuntu下来玩玩了,首先要感谢“过够了”的文章以下是按他的文章修改而来。在ubuntu下搭建比freebsd下速度要快得多,因为在freebsd我是用ports方式安装,需要编

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

    昨天在FreeBSD下玩了nginx+php,今天到ubuntu下来玩玩了,首先要感谢“过够了”的文章以下是按他的文章修改而来。在ubuntu下搭建比freebsd下速度要快得多,因为在freebsd我是用ports方式安装,需要编译,ubuntu下直接apt-get install 的方式安装,速度很快,下面就来开始安装吧!

    1,安装nginx,执行以下命令,很快完成,不过目前apg-get方式安装默认是0.5.33的版本

    sudo apt-get install nginx

    配置文件默认安装位置:

 

 conf: /etc/nginx/nginx.conf
bin:/usr/sbin/nginx
vhost: /etc/nginx/sites-enable/default
cgi-params: /etc/nginx/fastcgi-params

    例:建一个虚拟Server

   

 server {
listen 80;
server_name www.23day.com;
access_log /var/log/nginx/home.ucenter.access.log;

location / {
root /var/www/23day.com;
index index.php;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/23day.com$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}

    2,安装php-cgi模块

    执行sudo apt-get install php5-cgi

    配置文件默认安装位置:

 

 php-cgi: /usr/bin/php-cgi
php5-cgi: /usr/bin/php5-cgi
cgi config: /usr/bin/cgi/php.ini

    修改php.ini文件的cgi.fix_pathinfo数据为1,默认为0    cgi.fix_pathinfo=1; 这样php-cgi方能正常使用SCRIPT_FILENAME这个变量

[1] [2] 

Ubuntu8.04快速搭建nginx+php系统

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn