ubuntu上安装nginx+mysql+php5-fpm(PHP5 - FastCGI Process Manager)

题外话:由于近段时间测试环境ssh链路质量不大好,经常短线。故我把整个安装过程放到screen里去执行,以防止断线中断了安装过程。执行screen -S install,这样断线后,只要再执行screen -r install 就可以恢复之前的安装界面。

1.安装mysql

sudo apt-get install mysql-server mysql-client

安装过程中要设置mysql root用户的密码。

2.安装nginx

sudo apt-get install nginx

3.安装成功后。我们重启下nginx服务

sudo service nginx restart

启动之后我们就可以访问一下我们的地址了。看能不能出现nginx的欢迎界面。

4.安装php5-fpm(PHP5 - FastCGI Process Manager)。

sudo apt-get install php5-fpm

5.接下来我们要修改一下nginx的站点配置了。

ngnix的配置文件存放在/etc/nginx/sites-available/default

server {

listen 80; ## listen for ipv4; this line is default and implied

listen [::]:80 default ipv6only=on; ## listen for ipv6

root /usr/share/nginx/www;

index index.php index.html index.htm;

# Make site accessible from http://localhost/

server_name _;

location / {

# First attempt to serve request as file, then

# as directory, then fall back to index.html

try_files $uri $uri/ /index.html;

}

location /doc {

root /usr/share;

autoindex on;

allow 127.0.0.1;

deny all;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/www;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

location ~ \.php$ {

try_files $uri =404;

#fastcgi_pass 127.0.0.1:9000;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

include fastcgi_params;

}

# deny access to .htaccess files, if Apache‘s document root

# concurs with nginx‘s one

#

location ~ /\.ht {

deny all;

}

}

增加了php解析的一些代码在里面。

6.我们在安装php5相关的一些组件。

sudo apt-cache search php5

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

7.重启服务

sudo service php5-fpm restart

sudo service nginx

8.写个探针文件试试吧。呵呵。

时间: 2024-07-29 10:55:14

ubuntu上安装nginx+mysql+php5-fpm(PHP5 - FastCGI Process Manager)的相关文章

在Ubuntu上安装 nginx, MySQL, PHP (LEMP),phpmyadmin和WordPress

转载自 http://www.cnblogs.com/eecs/p/3963869.html 1)更新 Apt-Get 终端命令:sudo apt-get update 2)安装MySql 终端命令: sudo apt-get install mysql-server php5-mysql 3)安装Nginx sudo apt-get install nginx nginx不会自己启动,你需要启动它sudo service nginx start 命令如下所示,如果nginx安装成功了,可以在浏

Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL

Ubuntu 下 nginx , php , mysql 和 golang 的简单安装 我是搞php出身,自然安装lnmp是常规技能.以前的手段还是lnmp安装包,比如军哥的lnmp1.0.随着php和mysql的更新,大多数一键安装都开始版本老化,更新困难的问题.因此,重新研究了一下Ubuntu下lnmp的安装,发现现在简单的多,记录一下. 另外最近在学习golang,Ubuntu下安装自然也是必须的过程.不过golang的安装也有一些奥妙.当然,不是源码安装的啦. Nginx Stable/

如何在Ubuntu上安装Apache,MySQL,PHP,Nginx,HAProxy,以及如何在docker上安装LAMP

如何在Ubuntu上安装Apache,MySQL,PHP,Nginx,HAProxy,以及如何在docker上安装LAMP 在Ubuntu上安装LAMP: https://help.ubuntu.com/community/ApacheMySQLPHPhttps://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntuhttp://www.makete

ubuntu上安装mysql 编译安装

为什么要折腾?首先说明的是ubuntu上安装mysql等软件是非常容易简单的,其简单的程度盖过windows上的安装,一句sudo apt-get install就可以搞定.如果想用最简便的方法安装mysql,那么本文不适合你;如果你喜欢“折腾”,有兴趣了解这一条sudo apt-get install帮你做了什么,有兴趣了解internal linux的细节并想尝试自己编译软件,那么你是本文的目标读者,希望你能从这篇文章中获得收获. 编译安装的几大步骤: 编译前的准备工作 初识CMAKE——配

ubuntu上安装mysql及导入导出

ubuntu上安装mysql:  1. sudo apt-get install mysql-server 2. apt-get isntall mysql-client3. sudo apt-get install libmysqlclient-dev 安装好mysql之后,检查是否安装成功:sudo netstat -tap | grep mysql 检查成功后,那就是做做简单的测试了mysql -u root -p  其他的操作命令就和平时的一样了. 下面主要讲讲如何导出数据库文件和导入数

Centos上安装nginx+php-fpm+mysql

CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一. Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器. PHP-FPM是一个PHPFastCGI管理器,是只用于PHP的.简介PHP-FPM(FastCGI Process Manager:FastCGI进程管理器)对于PHP 5.3.3之前的php来说,是一个补丁包1,旨在

centos 6.3 编译安装 nginx +mysql + php

一篇文章是对另一篇文章的整理,作为记录收藏 1,配置防火墙,开启80端口.3306端口 配置iptables,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306端口

ubuntu下搭建nginx+mysql+php-fpm站点

概述 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器.  nginx的优势在于能以低内存高效率处理静态页面大量请求. 可以参考下:三大WEB服务器对比分析(apache ,lighttpd,nginx) PHP-FPM是为PHP内核编写的补丁,用来根据需要处理FastCGI进程的启动,停止以及重启.有点在于: 较低的内存占用率(因为nginx单独运行时不用加载整个PHP环境). 轻松地管理用户权限

在阿里云 CentOS 服务器(ECS)上搭建 nginx + mysql + php-fpm 环境

阿里云的云服务器(ECS)可以选择多种操作系统,打算用它运行 Drupal或者 WordPress ,你最好选择 Linux 系统,这篇文章的演示是基于阿里云的 CentOS 操作系统的服务器.我们在上面搭建一个 nginx + mysql + php-fpm 的环境,这就是常说的 LNMP .我们不过多解释什么是什么,而是着重讲流程与方法,想了解具体的细节,去搜索下吧:)这个手册是在阿里云上测试的,不过应该也适用于其它使用 CentOS 系统的服务器. 背景 宁皓网的< CentOS:在阿里云