服务器

deepin15.11安装lnmp环境

2020-04-01  本文已影响0人  这真的是一个帅气的名字
tar -zxvf php-7.3.16.tar.bz2
cd php-7.3.16/
sudo apt-get update
sudo apt install g++ autoconf openssl libssl-dev libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libxml2 libxml2-dev libxslt1-dev libzip-dev curl libcurl4-gnutls-dev
image.png

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-libdir=/lib/x86_64-linux-gnu --disable-rpath --enable-fpm --with-openssl --enable-bcmath --with-zlib --with-curl --enable-exif --enable-ftp --with-gd --with-webp-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-gettext --with-mhash --enable-intl --enable-mbstring --enable-mbregex --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --with-xmlrpc --with-libxml-dir=/usr --with-iconv-dir --with-xsl --enable-zip --with-libzip --enable-mysqlnd
image.png

配置环境

通常情况下,一般都是配置/etc/profice文件,不过我在配置过程中,当新打开一个终端的时候,配置会失效,所以我这边直接修改~/.bashrc文件了,注意此处的文件位置,一般在linux中,bashrc文件都是在/etc/bashrc中,而在deepin系统,此文件路径是在这 ~/.bashrc;

配置php-fpm

启动php-fpm

sudo php-fpm start,或者 sudo /etc/init.d/php-fpm start
后续可以通过sudo php-fpm restart重启,或通过命令sudo php-fpm stop停止.

安装nginx和MySQL

首先安装c++编译器

sudo apt-get install build-essential
sudo apt-get install g++
image.png

安装nginx

sudo apt install nginx

安装MySQL

sudo apt-get install mysql-server mysql-client
use mysql;
select user, plugin from user;//查询当前用户表的plugin自段是否是 mysql_native_password,如果不是。我们也需要修改
update user set authentication_string=password("你的密码") where user="root";//字段正确使用这行
update user set authentication_string=password("你的密码"),plugin='mysql_native_password' where user='root';//字段不正确使用这行
flush privileges;
quit
image.png

然后把刚改的文件删除或者注释。接着重启mysql服务。就可以使用正确密码进入了。

server {
        listen 80;
        server_name test.com;
        root /www/test;
        
        index index.html index.htm index.php;
     
        # Access Restrictions
        allow       127.0.0.1;
        deny        all;
    
        location / {
            try_files $uri $uri/ =404;
            autoindex on;
        }
        
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;      
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        }
        
        charset utf-8;
        
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
        location ~ /\.ht {
            deny all;
        }
        
    }

然后在系统根目录新建一个放项目的文件夹www,然后给读写权限sudo mkdir /www; sudo chmod -R 777 /www




本人有关于PHP、服务器、Java、swoole、数据库、前端等视频课程。
需要的同学可以关注公众号:小贝壳的资源库。免费获取

image
上一篇 下一篇

猜你喜欢

热点阅读