ubuntu20 配置php服务器 laravel5.8

做以下步骤以前,检查阿里云相关端口,及服务器防火墙

1、更新包:apt update

2、安装git

      1)apt-get install git

       2) 检查是否安装成功:git --version

       3) 安装项目:git clone 仓库地址,如果是码云仓库需要配置ssh公钥

3、安装systemctl:服务管理,apt-get install systemctl

4、安装php、php-fpm:api-get install php php-fpm

5、安装composer:

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

     2)  mv composer.phar /usr/local/bin/composer

     3) 配置阿里云:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

6、使用composer安装项目:

     composer install

    报错:requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

    解决:apt-get install php-mbstring

    报错:requires ext-curl * -> the requested PHP extension curl is missing from your system.

    解决: apt-get install php-curl

    报错:requires ext-dom * -> the requested PHP extension dom is missing from your system.

   解决:apt-get install php-dom

   报错:requires ext-gd * -> the requested PHP extension gd is missing from your system.

   解决:apt-get install php-gd

  报错:requires ext-zip * -> the requested PHP extension zip is missing from your system.

   解决:apt-get install php-zip

  报错:requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.

  解决:apt-get install php-bcmath

7、nginx

     1) 安装:apt-get install nginx

     2) 检查安装:nginx -v

     3) 检查配置文件:nginx -t

     4) 配置:

server {

    listen      443;

    server_name  域名;

    index index.html index.htm index.php;

    root    项目根目录;

    charset utf-8;

 

    ssl on;

    ssl_certificate 证书地址;

    ssl_certificate_key 证书私钥地址;

    ssl_session_timeout 5m;

    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

    #ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    ssl_prefer_server_ciphers on;

 

    access_log  日志文件地址;

    error_log   错误日志地址;

   location / {

            try_files $uri $uri/ /index.php?$query_string;

    }

 

    location /storage {

           alias /home/shanhu_travel/storage/app/public;

           autoindex on;

    }

    sendfile off;

    client_max_body_size 100m;#请求体最大值

    location ~ \.php$ {

            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_pass unix:/run/php/php7.4-fpm.sock;

            fastcgi_index index.php;

            include fastcgi_params;

            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

            fastcgi_intercept_errors off;

            fastcgi_buffer_size 16k;

            fastcgi_buffers 4 16k;

            fastcgi_connect_timeout 300;

            fastcgi_send_timeout 300;

            fastcgi_read_timeout 300;

    }

}

 

#http转https

server {

    listen 80;

    server_name 域名;

    return 307 https://$server_name$request_uri;#该出只能为307,否则http转到https时请求方法及请求数据没有

    #rewrite ^(.*)$ https://$host$1;

}

 

8、mysql8.0:

     1)安装:apt-get install mysql-server mysql-client

     2) 设置密码: mysql_secure_installation,按提示操作,如果没法设置,则执行mysqld --initialize --user=mysql --console

        操作https://www.cnblogs.com/llb123/p/13398701.html

     3) 远程连接:ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '密码';FLUSH PRIVILEGES;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值