LNMP环境快速部署

介绍

什么是LNMP?

简单的说,LNMP指的就是,在Linux系统下Nginx+MySQL+PHP这种网站服务器架构。

  • Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统。代表版本有:debian、centos、ubuntu、fedora、gentoo等。
  • Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器。
  • Mysql是一个小型关系型数据库管理系统。
  • PHP是一种在服务器端执行的嵌入HTML文档的脚本语言。

安装

安装nginx

apt-get install nginx

修改nginx配置文件

server {
    listen 80 default_server;
    listen [::]:80 default_server;

   root /var/www/html;
    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;
    server_name _;
    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;

           # With php5-cgi alone:
            fastcgi_pass 127.0.0.1:9000;
            include /etc/nginx/fastcgi_params;
            # With php5-fpm:
            # fastcgi_pass unix:/var/run/php5-fpm.sock;
    }
}

安装mysql

apt-get install mysql-server
# 安装过程中设置密码

安装php及组件:

apt-get install php5 php5-fpm php5-mysql

修改php-fpm:/etc/php5/fpm/pool.d/www.conf配置

;listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000

安装phpmyadmin

apt-get install phpmyadmin

修改phpmyadmin配置文件

配置文件为: config.sample.inc.php

cp config.sample.inc.php config.inc.php

创建软连接到/var/www/html/目录:

ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

启动服务

service nginx start

service php-fpm start

service mysql start

访问 http://127.0.0.1/phpmyadmin

原始链接:http://wuyue92tree.antio.top/2016/12/17/lnmp-fast-deploy/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值