美文网首页
Cloud Studio搭建php7.3,nginx,mysql

Cloud Studio搭建php7.3,nginx,mysql

作者: 空气KQ | 来源:发表于2019-06-17 17:03 被阅读0次

    开发工具

    https://studio.dev.tencent.com/

    第一步选择Ubuntu 16.04 已安装 Python 2.7.12,Python 3.5.2

    安装nginx服务

    sudo apt-get update
    sudo apt-get install nginx
    

    启动

    sodu sevice nginx start
    

    测试是否成功


    image.png

    点击访问


    image.png

    安装php7.3

    sudo apt -y install software-properties-common apt-transport-https lsb-release ca-certificates
    sudo add-apt-repository ppa:ondrej/php  
    sudo apt update
    sudo apt install php7.3-fpm php7.3-mysql php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-xmlrpc php7.3-zip php7.3-opcache -y
    
    

    设置php配置

    sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.3/fpm/php.ini 
    

    检查是否安装成功

    sodu php -v
    

    操作命令

    sudo service php7.3-fpm restart  #重启
    sudo service  php7.3-fpm start #启动
    sudo service php7.3-fpm stop  #关闭
    sudo service  php7.3-fpm status #检查状态
    
    

    安装mysql5.7

    我本来想安装8.0的,不知道为何给我安装了5.7,那就5.7吧

    sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
    sudo apt update
    sudo apt install mysql-server
    》然后输入mysql密码即可
    

    启动

    sudo service mysql restart  #重启
    sudo service  mysql  start #启动
    sudo service mysql  stop  #关闭
    sudo service  mysql  status #检查状态
    

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock
    如果提示启动不了,执行

    sudo chown -R mysql:mysql /var/lib/mysql

    配置nginx+参数

    cd 到配置虚拟目录下

    cd /etc/nginx/conf.d
    
    vim demo.conf
    

    内容

    server {
       listen 8088 default_server;
        listen [::]:8088 default_server;
    
        root /var/www/html;
        index index.php index.html index.htm index.nginx-debian.html;
    
        server_name localhost;
    
        location / {
                    try_files $uri $uri/ /index.php?$args;
        }
    
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        }
    }
      
    

    cd /var/www/html

    vim index.php
    
    
    <?php
    echo phpinfo();
    ?>
    
    image.png

    配置laravel 环境

    安装composer

    curl -sS https://getcomposer.org/installer | php
    
    

    设置全局

    sudo mv composer.phar /usr/local/bin/composer
    compsoer -v
    
    
    ➜  ~ composer -v
       ______
      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                        /_/
    Composer version 1.8.6 2019-06-11 15:03:05
    
    
    

    搞定composer

    设置国内源

    sudo composer config -g repo.packagist composer https://packagist.laravel-china.org
    
    

    tips

    
    composer config -g --unset repos.packagist # 取消全局配置
    

    安装laravel

    sudo composer create-project --prefer-dist laravel/laravel lv
    
    cd /etc/nginx/conf.d
    vim lv.conf
    
    server {
       listen 8082 default_server;
        listen [::]:8082 default_server;
    
        root /home/coding/workspace/lv/public;
        index index.php index.html index.htm index.nginx-debian.html;
    
        server_name localhost;
    
        location / {
                    try_files $uri $uri/ /index.php?$args;
        }
    
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        }
    }
    
    sudo service nginx restart
    

    设置laravel权限

    sudo chmod -R 777 /home/coding/workspace/lv/storage/
    
    

    创建访问地址


    image.png

    安装swoole 扩展

    安装几个扩展先

    sudo apt-get install php7.3-sockets  openssl php7.3-mysqlnd
    

    安装pecl

    sudo apt-get install php-dev php-pear autoconf automake libtool -y
    
    sudo pecl install swoole
    
    后面请输入yes
    
    sudo vim /etc/php/7.3/fpm/php.ini
    最后位置加入
    extension=swoole.so
    
    sudo vim /etc/php/7.3/cli/php.ini
    最后位置加入
    extension=swoole.so
    
    sudo service nginx restart
    sudo service php7.3-fpm restart
    

    反正这是一套完全linux 自己配置环境,你想怎么玩就怎玩

    相关文章

      网友评论

          本文标题:Cloud Studio搭建php7.3,nginx,mysql

          本文链接:https://www.haomeiwen.com/subject/yixzfctx.html