zoukankan      html  css  js  c++  java
  • LNMP环境的安装

    1、 使用官方仓库安装Nginx

    [root@web01 ~]# vim /etc/yum.repos.d/nginx.repo
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/7/$basearch/
    gpgcheck=0
    enabled=1

    安装Nginx

    [root@web01 ~]# yum install nginx -y

    2.安装php7.1

    [root@web01 ~]# yum remove php-mysql-5.4 php php-fpm php-common
    [root@web01 ~]# vim /etc/yum.repos.d/php.repo
    [php]
    name = php Repository
    baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/
    gpgcheck = 0

    [root@web01 ~]# yum -y install php71w php71w-cli php71w-common
    php71w-devel php71w-embedded php71w-gd php71w-mcrypt
    php71w-mbstring php71w-pdo php71w-xml php71w-fpm
    php71w-mysqlnd php71w-opcache php71w-pecl-memcached
    php71w-pecl-redis php71w-pecl-mongodb

    3.安装Mariadb数据库

    [root@web01 ~]# yum install mariadb-server mariadb -y

    4.配置nginx与php集成,修改配置文件

    [root@web01 conf.d]# cat php.conf
    server {
    listen 80;
    server_name php.ljp.com;
    root /code;

    location / {
    index index.php index.html;
    }

    location ~ .php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }

    5.重载NGINX并加入开机自启

    [root@nginx conf.d]# systemctl start nginx
    [root@nginx conf.d]# systemctl enable nginx

    6.启动php-fpm,并加入开机自启

    [root@web01 conf.d]# systemctl start php-fpm
    [root@web01 conf.d]# systemctl enable php-fpm

    7.准备一个php文件,测试nginx与php是否集成成功

    [root@web01 conf.d]# cat /code/page.php

    8.启动数据库并加入开机自启

    [root@web01 conf.d]# systemctl start mariadb
    [root@web01 conf.d]# systemctl enable mariadb

    给数据库设置一个密码

    [root@web01 conf.d]# mysqladmin password '123'

  • 相关阅读:
    vue中插槽的使用场景
    css实现文字两端对齐
    es6 every的使用
    es6 filter方法应用
    es6 map的用法
    spring-servlet.xml
    Spring MVC过滤器HiddenHttpMethodFilter
    controller大全(推荐)
    目前接触到的UI
    jdk环境配置(windows版)
  • 原文地址:https://www.cnblogs.com/longren/p/10991652.html
Copyright © 2011-2022 走看看