LNMP搭建(Ubuntu10.04+Nginx+PHP-FPM)
2015-03-10 17:38
507 查看
在原来已经搭建好LAMP的Ubuntu10.04 中安装Nginx步骤
1. 安装Nginx
参考http://blog.163.com/abkiss@126/blog/static/3259410020121029113444717/ 安装Nginx,
2. 安装php-fpm
apt-get install php5-fpm
apt-get install php5-cgi
3. 配置Nginx
修改/etc/nginx/sites-available/default 将listen 80 default; 改为listen 8888 default; 即将80端口修改为其他端口,防止与
原来的apache端口冲突
修改
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#includefastcgi_params;
#}
为
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/$fastcgi_script_name;
include fastcgi_params;
}
注意红色位置,是为了让php-fpm找到需要解析的php文件,如果不加,会报404错误。
这个可能可以使用某个变量代替,由于刚接触Nginx,尚不知,回头研究。
4. 启动php-fpm 和nginx
sudo /etc/init.d/php5-fpm start
sudo /etc/init.d/nginx start
nginx默认监听的是php5-fpm 中配置的127.0.0.1 的9000端口
默认webroot是
/var/www/nginx-default
可以在该目录下新建php文件进行测试是否搭建成功。
1. 安装Nginx
参考http://blog.163.com/abkiss@126/blog/static/3259410020121029113444717/ 安装Nginx,
2. 安装php-fpm
apt-get install php5-fpm
apt-get install php5-cgi
3. 配置Nginx
修改/etc/nginx/sites-available/default 将listen 80 default; 改为listen 8888 default; 即将80端口修改为其他端口,防止与
原来的apache端口冲突
修改
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#includefastcgi_params;
#}
为
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/$fastcgi_script_name;
include fastcgi_params;
}
注意红色位置,是为了让php-fpm找到需要解析的php文件,如果不加,会报404错误。
这个可能可以使用某个变量代替,由于刚接触Nginx,尚不知,回头研究。
4. 启动php-fpm 和nginx
sudo /etc/init.d/php5-fpm start
sudo /etc/init.d/nginx start
nginx默认监听的是php5-fpm 中配置的127.0.0.1 的9000端口
默认webroot是
/var/www/nginx-default
可以在该目录下新建php文件进行测试是否搭建成功。
相关文章推荐
- ubuntu搭建 nginx+php7+php-fpm+mysql
- ubuntu13.04 搭建 Nginx + PHP + PHP-FPM + Mysql (lnmp) 环境
- ubuntu10.04配置 nginx+php-fpm模式的详解
- ubuntu10.04配置 nginx+php-fpm模式的详解
- LNMP环境 搭建 多站点 配置 Ubuntu12 04 Nignx Mysql Php(php5-fpm )
- Nginx+php(fastcgi)搭建LNMP
- Ubuntu 搭建LNMP环境图文教程 安装PHP
- ubuntu10.04使用源安装php-fpm
- Ubuntu 使用apt-get安装Nginx php5-fpm MySQL(LNMP环境搭建)
- ubuntu安装nginx+php-fpm+mysql
- ubuntu10.04 安装php-fpm
- 在 Linode(VPS)上搭建Ubuntu 10.04 Apache PHP MYSQL环境
- ubuntu 10.04 搭建 Nginx + MySQL + PHP5.3环境搭建
- ubuntu通过apt-get方式搭建lnmp环境以及php扩展安装
- Ubuntu安装nginx php5-fpm mysql (lnmp环境搭建)
- ubuntu 10.10 nginx+php+php-fpm+mysql简单搭建实现
- Mantis 迁移手记(Ubuntu Server 10.04 + Nginx 1.x + PHP-FPM 5.x + Mantis 1.2.8)
- Ubuntu安装nginx php5-fpm mysql (lnmp环境搭建)
- ubuntu10.04配置 nginx + php-fpm 模式
- Ubuntu 10.04 系统下Php环境搭建