网页原创链接:https://www.cnblogs.com/lalaza/p/11258929.html

目标,访问网站出现:

-----------------------分割线----------------------------------------

一、Laravel Homestead 环境安装(腾讯云不支持!)

  试了各种方法,一直报错,最后在旧版腾讯云贴吧里面找到官方解答

内心各种曹尼玛啊啊啊啊啊!

二、测试环境长期关闭 防火墙&SELinux

  1. //关闭
  2. systemctl stop firewalld
  3. //关闭开机启动
  4. systemctl disable firewalld
  1. //临时关闭SELinux
  2. setenforce 0
  3.  
  4. vim /etc/selinux/config
  5. SELINUX=enforcing 改成SELINUX=disabled

三、安装nginx

  1. cd /etc/yum.repos.d/
  2. vim nginx.repo

复制下列文本至 nginx.repo (文本来源)

  1. [nginx-stable]
  2. name=nginx stable repo
  3. baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
  4. gpgcheck=1
  5. enabled=1
  6. gpgkey=https://nginx.org/keys/nginx_signing.key
  7.  
  8. [nginx-mainline]
  9. name=nginx mainline repo
  10. baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
  11. gpgcheck=1
  12. enabled=0
  13. gpgkey=https://nginx.org/keys/nginx_signing.key
  1. yum list | grep nginx
  2. yum -y install nginx
    nginx -v
  3.  
  4. mkdir /www
  5. mkdir /www/wwwroot
  6. mkdir /www/wwwroot/default
  7. cd /www/wwwroot/default
  8. vim index.html

输入至 index.html

  1. Hellow World!!!
  1. cd /etc/nginx/conf.d
  2. vim default.conf

  1. systemctl start nginx
    systemctl enable nginx

四、安装PHP

  1. yum -y install epel-release
  2. rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
  3. yum list | grep php72
  4. yum -y install mod_php72w php72w-cli php72w-fpm php72w-common php72w-devel
  1. mkdir /www/wwwroot/learn
  2. cd /www/wwwroot/learn
  3. vim index.php

输入至 index.php

  1. <?php
  2. phpinfo();
  3. ?>
  1. cd /etc/nginx/conf.d
    vim learn.conf

输入下文,

  1. server {
  2. listen 8080;
  3. server_name localhost;
  4. root /www/wwwroot/learn;
  5.  
  6. add_header X-Frame-Options "SAMEORIGIN";
  7. add_header X-XSS-Protection "1; mode=block";
  8. add_header X-Content-Type-Options "nosniff";
  9.  
  10. index index.php index.html index.htm;
  11.  
  12. charset utf-8;
  13.  
  14. location / {
  15. try_files $uri $uri/ /index.php?$query_string;
  16. }
  17.  
  18. location = /favicon.ico { access_log off; log_not_found off; }
  19. location = /robots.txt { access_log off; log_not_found off; }
  20.  
  21. error_page 404 /index.php;
  22.  
  23. location ~ \.php$ {
  24. root /www/wwwroot/learn;
  25. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  26. fastcgi_pass 127.0.0.1:9000;
  27. fastcgi_index index.php;
  28. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  29. include fastcgi_params;
  30. }
  31.  
  32. location ~ /\.(?!well-known).* {
  33. deny all;
  34. }
  35. }
  1. systemctl restart nginx
  2. systemctl start php-fpm
    systemctl enable php-fpm

五、安装MYSQL

  1. cd ~
  2. rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-.noarch.rpm
  3. yum list | grep mysql
  4. yum-config-manager --disable mysql80-community
  5. yum-config-manager --enable mysql57-community
  6. yum list | grep mysql
  7. //这步安装时间长,请耐心等待,看你的网络状况
  8. yum -y install mysql-community-server mysql-community-client
  9. systemctl start mysqld
  10. systemctl enable mysqld
  11. //设置MySQL
  12. set global validate_password_policy=;
  13. set global validate_password_mixed_case_count=;
  14. set global validate_password_number_count=;
  15. set global validate_password_special_char_count=;
  16. set global validate_password_length=;
  17. //复制好密码
  18. grep 'temporary password' /var/log/mysqld.log
  19. mysql -uroot -p
  20. (输入密码)
  21. set password for root@localhost = password('root');
    //退出MySQL
    exit

六、安装composer

  1. cd /tmp
  2. curl -sS https://getcomposer.org/installer | php
  3. mv composer.phar /usr/local/bin/composer
  4. composer -v
  5. composer config -g repo.packagist composer https://packagist.phpcomposer.com

七、配置Laravel 项目(链接请都点开)

  1. //安装 laravel
  2. composer global require laravel/installer

配置环境变量,PATH,

下载离线包,找最新的下

上传文件夹,并解压至 '/www/wwwroot/learn2' 文件夹

  1. cd /www/wwwroot/learn2
  2. vim .env

写入下列内容,

  1. APP_NAME=Laravel
  2. APP_ENV=local
  3. APP_KEY=base64:fYG9POLRD3bFB/eAfyRGNakdfbwTVDObop+imw7U42Q=
  4. APP_DEBUG=true
  5. APP_URL=http://localhost
  6.  
  7. LOG_CHANNEL=stack
  8.  
  9. DB_CONNECTION=mysql
  10. DB_HOST=127.0.0.1
  11. DB_PORT=
  12. DB_DATABASE=laravel
  13. DB_USERNAME=root
  14. DB_PASSWORD=
  15.  
  16. BROADCAST_DRIVER=log
  17. CACHE_DRIVER=file
  18. QUEUE_CONNECTION=sync
  19. SESSION_DRIVER=file
  20. SESSION_LIFETIME=
  21.  
  22. REDIS_HOST=127.0.0.1
  23. REDIS_PASSWORD=null
  24. REDIS_PORT=
  25.  
  26. MAIL_DRIVER=smtp
  27. MAIL_HOST=smtp.mailtrap.io
  28. MAIL_PORT=
  29. MAIL_USERNAME=null
  30. MAIL_PASSWORD=null
  31. MAIL_ENCRYPTION=null
  32.  
  33. AWS_ACCESS_KEY_ID=
  34. AWS_SECRET_ACCESS_KEY=
  35. AWS_DEFAULT_REGION=us-east-
  36. AWS_BUCKET=
  37.  
  38. PUSHER_APP_ID=
  39. PUSHER_APP_KEY=
  40. PUSHER_APP_SECRET=
  41. PUSHER_APP_CLUSTER=mt1
  42.  
  43. MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
  44. MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
  1. vim /etc/nginx/conf.d/learn2.conf

写入内容,

  1. server {
  2. listen ;
  3. server_name localhost;
  4. root /www/wwwroot/learn2/public;
  5.  
  6. add_header X-Frame-Options "SAMEORIGIN";
  7. add_header X-XSS-Protection "1; mode=block";
  8. add_header X-Content-Type-Options "nosniff";
  9.  
  10. index index.php index.html index.htm;
  11.  
  12. charset utf-;
  13.  
  14. location / {
  15. try_files $uri $uri/ /index.php?$query_string;
  16. }
  17.  
  18. location = /favicon.ico { access_log off; log_not_found off; }
  19. location = /robots.txt { access_log off; log_not_found off; }
  20.  
  21. error_page /index.php;
  22.  
  23. location ~ \.php$ {
  24. root /www/wwwroot/learn2/public;
  25. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  26. fastcgi_pass 127.0.0.1:;
  27. fastcgi_index index.php;
  28. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  29. include fastcgi_params;
  30. }
  31.  
  32. location ~ /\.(?!well-known).* {
  33. deny all;
  34. }
  35. }

八、填坑

打开网页 'IP:8081', 各种报错,

先在'www/wwwroot/learn2/public/index.php' 里添加:

  1. ini_set('display_errors',1);
  2. error_reporting(E_ALL);
  1. cd /www/wwwroot/learn2
  2. chmod -R *
  3. yum -y install php72w-pdo
  4. yum -y install php72w-mysql
  5. systemctl restart php-fpm
  6. php artisan key:generate

OK!,出现:

腾讯云centos7 从零搭建laravel项目的更多相关文章

  1. 腾讯云centos7服务器环境搭建,tomcat+jdk+mysql+nginx

    软件:jdk 1.8.0_45 tomcat 8.5.8 mysql 5.6.36 nginx 1.10.x或以上 其中tomcat在centos6.8中没问题,centos7中会出现卡在启动那里 I ...

  2. 腾讯云CENTOS7安装MSSQL2017

    腾讯云CENTOS7安装MSSQL2017 mkdir -p /opt/sqlserver2017cd /opt/sqlserver2017/ 下载离线包:wget https://packages. ...

  3. 基于docker搭建laravel项目

    基于docker搭建laravel项目 公司PHP项目是Laravel框架写的,目前环境需要通过docker来部署一下.网上学习了一下相关知识.整理后做一个笔记.用到定时任务crontab与进程管理s ...

  4. 腾讯云CentOS7安装LNMP+wordpress

    许多云主机都有学生优惠,于是我趁着现在大一买了个腾讯1元云主机+免费cn域名(高中生的话就别想了).鉴于我只知道用服务器安装博客,别的用途不了解,所以我就去安装wordpress. 而由于我看的教程有 ...

  5. 阿里云服务器部署php的laravel项目,在阿里云买ECS 搭建 Linux+Nginx+Mysql+PHP环境的

    在阿里云买ECS的时候选择自己习惯的镜像系统,我一般都是使用Linux Ubuntu,所以,以下的配置都是在Ubuntu 14.04稳定支持版的环境中搭建Linux+Nginx+Mysql+PHP环境 ...

  6. 腾讯云centos7远程连接配置

    1.申请腾讯云 注册腾讯云账号,申请一个centos7的服务器,1G内存,1核处理器,1M网速. 对于这种入门级配置,建议还是别用windows server了,不然不装任何东西,光运行系统就需要60 ...

  7. 腾讯云centos7.2安装jdk1.7 tomcat7.0部署项目示例

    说实话win server的性能并不好,所以程序员必须会在Linux上安装环境,部署项目. 第一步,官网下载tomcat和jdk压缩文件*.tar.gz  下载路径如下: jdk:http://www ...

  8. 腾讯云CentOS7.4服务器添加swap分区

    自己的腾讯云服务器搭建的zabbix监控中,提示Lack of free swap space 腾讯的官方说明在这: https://cloud.tencent.com/document/produc ...

  9. 腾讯云CentOS7.0使用yum安装mysql

    背景: 今天才申请了腾讯云+校园计划的1元服务器,(https://www.qcloud.com/event/qcloudSchool)安装了Centos7.0,在安装mysql的时候,使用yum l ...

随机推荐

  1. 使用pjax实现类似github无刷新更改页面url

    pjax=pushState+ajax,相信用过github的同学都知道,github部分页面采用了pjax这个项目来实现ajax无刷新加载的同时改变页面url.一起来学习一下这个插件吧. 我们都知道 ...

  2. Laravel --- 【转】安装调试利器 Laravel Debugbar

    [转]http://www.tuicool.com/articles/qYfmmur 1.简介 Laravel Debugbar 在 Laravel 5 中集成了 PHP Debug Bar ,用于显 ...

  3. 微服务SpringCloud之服务注册与发现

    在找.net core 微服务框架时发现了Steeltoe开源项目,它可以基于Spring Cloud实现.net core和.net  Framework的微服务.正好之前也有学习过SpringBo ...

  4. maven中引入oracle驱动报错Missing artifact com.oracle:ojdbc14:jar

    maven中央库中查找ojdbc14 ,复制依赖,maven项目中引入ojdbc14 来回折腾,加仓库镜像,各种修改setting.xml 文件 就是不行,后来看到一位网友博客,MMP Oracle ...

  5. 使用Python爬取微信公众号文章并保存为PDF文件(解决图片不显示的问题)

    前言 第一次写博客,主要内容是爬取微信公众号的文章,将文章以PDF格式保存在本地. 爬取微信公众号文章(使用wechatsogou) 1.安装 pip install wechatsogou --up ...

  6. Centos6 samba服务配置

    1.在阿里虚拟机中配置包源  在ecs的 /etc/yum.repos.d 创建个 alios.repo,内容如下 [alios.$releasever.base.$basearch] name=al ...

  7. 教妹子用IDEA创建web应用,部署到Tomcat服务器

    自从上一篇原创发表之后,粉丝反应热烈.主要分两派,一派关注技术的,觉得看了那么多的公众号文章,终于找到一篇能看懂的了,于是沾沾自喜.另一派是关注妹子的,感叹自己空有一身绝技,公司里却无妹子可教,大喊可 ...

  8. linux 下 设置 MySQL8 表名大小写不敏感方法,解决设置后无法启动 MySQL 服务的问题

    在安装完成之后,初始化数据库之前,修改 my.cnf 打开mysql配置文件 vim /etc/my.cnf 在尾部追加一行 lower_case_table_names=1 并保存,然后再初始化数据 ...

  9. 小白也能看懂的 Laravel 核心概念讲解

    自动依赖注入 什么是依赖注入,用大白话将通过类型提示的方式向函数传递参数. 实例 1 首先,定义一个类: /routes/web.php class Bar {} 假如我们在其他地方要使用到 Bar  ...

  10. RabbitMq-安装篇

    嘿,大家好,今天更新的内容是rabbitMq的安装篇~~ windows下安装rabbitMq rabbitMq下载地址:点我下载 1.由于rabbitMq用erlang语言开发,所以安装rabbit ...