Ubuntu 14.04 搭建 lnmp环境

    xiaoxiao2021-03-25  21

    1 php

    安装 php5.4--php5.6版本

    $ sudo apt-get install python-software-properties $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip php5.6-xml php5.6-fpm

    2 nginx

    安装 nginx

    $ sudo apt-get install nginx

    配置 nginx 的 fpm 配置

    `location ~ \.php$ { try_files $uri $uri/ =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }`

    3 mysql

    安装版本 mysql5.7 (5.5不支持 utf8bom 字符编码)

    $ wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb

    安装 deb 包

    $ dpkg -i mysql-apt-config_0.8.0-1_all.deb

    apt 更新 ,安装

    $ sudo apt-get update $ sudo apt-get install mysql-server

    4 创建用户组,新用户

    创建用户组

    groupadd super

    在super用户组下创建用户

    useradd -g super leon

    修改leon用户密码

    passwd leon Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

    修改新用户的 shell 类型 和 sudo 权限,修改 /etc/sudoers文件

    su //获取su权限 chmod u +x /etc/sudoers //修改为可写 //添加一个 super 用户组的人 可以在任何主机上 运行 root的身份 运行所有命令 % super ALL=(ROOT) ALL

    发现新用户 leon 无法使用shell命令,打开 /etc/passwd 修改用户 使用的 shell 类型

    sudo usermod -s shell类型 用户名 sudo usermod -s /bin/bash leon

    转载请注明原文地址: https://ju.6miu.com/read-150104.html

    最新回复(0)