您的位置:首页 > 博客中心 > 数据库 >

Ubuntu安装PHP+Mysql+Nginx

时间:2022-03-14 04:32

1、安装PHP 5

我们必须通过 才能让PHP5正常工作,安装命令:

apt-get install php5-fpm

php-fpm是一个守护进程。

2、安装Mysql 5 数据库

安装 MySQL 运行命令:

apt-get install mysql-server mysql-client

安装过程中会询问建立 Root 账户密码,连续输入两次:

New password for the MySQL “root” user: <– 输入你的密码
Repeat password for the MySQL “root” user: <– 再输入一次

 

3 安装 Nginx

在安装 Nginx 之前,如果你已经安装 Apache2 先删除在安装 nginx:

service apache2 stop
update-rc.d -f apache2 remove
apt-get remove apache2

apt-get install nginx

启动 nginx 服务:

service nginx start

试试安装是否成功,在浏览器输入localhost 或者IP地址,如果出现 Welcome to nginx!,说明安装成功:

 

Welcome to nginx!

 

3-1 配置Nginx

在 Ubuntu 14.04 中默认的根目录为 /usr/share/nginx/html.

nginx配置文件  vim /etc/nginx/nginx.conf

默认虚拟主机设置文件 vim /etc/nginx/sites-available/default

 

(纯属自己记得笔记)

热门排行

今日推荐

热门手游