centos7安装LNMP与Laravel遇到的一些小问题
安装LNMP
第一次安装
- yum update
- CentOS7下 Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装
- 安装mySQL时,
mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory,innobackupex: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory 解决办法中使用了yum install numactl -y安装了依赖包,不过其他问题来了。
搞坏了一个东西,重装吧。而且这篇排版啥的pre标签文字过长都隐藏了不好重新找一个yum安装吧。
第二次安装
- nginx安装后用
nginx可以直接启动
nginx
nginx -s stop|reload
也可 service nginx start
还可以直接 /usr/sbin/nginx
- mysql
[root@]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@]# service mysqld status
提醒重定向 systemctl 但是也是可以用 service mysqld start/stop 启停的,service mysqld status 查看状态。
重置密码的时候,提醒Your password does not satisfy the current policy requirements (mysql文档规定,密码必须包括大小写字母数字加特殊符号>8位),那么复杂以后肯定会忘记的(暴雪账号忘过太多次了),基于 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements中 mysql> set global validate_password_policy=0; 设置参数为0,则只判断长度。
- php也是傻瓜式安装,需启动php-fpm。修改完配置后也需要重启php-fpm
service php-fpm start|stop
访问php页面会直接下载,需要配置nginx,我最后的配置是
server {
location / {
index index.html index.htm index.php;
}
location ~ .php$ {
# root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
可惜没有用户权限管理。
Laravel
- 安装 Composer
curl -sS https://getcomposer.org/installer | php 下载得到 composer.phar
参考 Composer简介中mv composer.phar /usr/local/bin/composer放到执行目录,方可直接composer命令直接调用。
- 安装 Laravel
ln -s /usr/share/nginx/html/vendor/bin/laravel /usr/local/bin/laravel 给执行目录下放个链接
laravel new messages
或者直接 /usr/share/nginx/html/vendor/bin/laravel new messages
The stream or file "/.../html/messages/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
storage 目录需要权限 chmod -R 777 storage
开发
navicat ssl 远程连接 mysql
新增数据库用户及密码:CREATE USER 'cowpea'@'%' IDENTIFIED BY 'Cowpea1!'
- CentOS 7上安装MySQL并配置远程安全连接
- linux CentOS 安装rz和sz命令 lrzsz用来下载文件,下载mysql客户端证书
- 用Navicat for MySQL 连接 CentOS 6.5
使用
Laravel 使用数据库时 Connections using insecure transport are prohibited while --require_secure_transport=ON.,mysql ssl问题,错误出来的那一刹都已经预料到,加了ssl就不能回头了啊,继续搞。
- Enabling Secure Connection To Remote Database
- Laravel: Fatal Error: Memory Bytes Exhausted With Remote Database
给./config/database.php加上:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
//for ssl.... :(
'sslmode' => env('DB_SSLMODE', 'prefer'),
'options' => array(
PDO::MYSQL_ATTR_SSL_KEY => '/var/lib/mysql/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/var/lib/mysql/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/var/lib/mysql/ca.pem',
),
],
注册登录错误
访问错误:
访问 messages/public/register 时,出错404,nginx配置。
老板,来一份配置,少放点辣子 Laravel 在 Nginx 中的参考配置两份
根目录直接放public目录吧,好开发。
注册错误:
试着注册一个账号,
SQLSTATE[HY000] [2026] SSL connection error: Unable to get private key (SQL: select count(*) as aggregate from `users` where `email` = ss@qq.com)
用了一个多小时,
还是没有解决,
加了\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false也没用,我的没有这个 Undefined class constant 'MYSQL_ATTR_SSL_VERIFY_SERVER_CERT'
终于发现了救命稻草:
PHP application cannot connect to MySQL over SSL
After a few bug reports and complaints a new PDO::MySQL attribute was added in php-7.0.18, php-7.1.4 with commit 247ce052cd0fc7d0d8ea1a0e7ea2075e9601766a but not documented in the official documentation.
If after adding this parameter you get an error message
PHP message: Error: Undefined class constant 'MYSQL_ATTR_SSL_VERIFY_SERVER_CERT'
then your PHP version does not support that parameter and you need to upgrade.
卧槽,还得升级到7.1.4我是7.1.14,我弄个锤子的SSL啊,毁我青春。赶紧去掉/etc/my.cnf的ssl配置。
centos7安装LNMP与Laravel遇到的一些小问题的更多相关文章
- 腾讯云CentOS7安装LNMP+wordpress
许多云主机都有学生优惠,于是我趁着现在大一买了个腾讯1元云主机+免费cn域名(高中生的话就别想了).鉴于我只知道用服务器安装博客,别的用途不了解,所以我就去安装wordpress. 而由于我看的教程有 ...
- centos7安装Lnmp(Linux+Nginx+MySql+Php+phpMyAdmin+Apache)
centos7安装Lnmp(Linux+Nginx+MySql+Php)及Apache Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx是一个高性能的HTTP和反向代理服务器,Ng ...
- Centos7 安装lnmp
Centos7 安装lnmp 1.下载 wget http://soft.vpser.net/lnmp/lnmp1.5-full.tar.gz 2.解压 tar -zvxf lnmp1.5-full. ...
- CentOS7 下安装 Lnmp 架设 Laravel
最近在hostos上买了个香港的 vps, 装的 centos7, 在架设了 pptp vpn, 效果还行,就想顺便架设个 laravel 看看.下面是架设的过程.准备工作 更新 yum 源,自带的源 ...
- CentOS7 安装LNMP(Linux+Nginx+MySQL+PHP)
由于工作须要,须要学习php,本来想安装lamp的可是考虑到如今nginxserver有良好的性能且应用广泛. 这里我决定搭建Linux(CentOS7+Nginx+MySQL+PHP)下的webse ...
- Centos7安装lnmp环境
系统版本:centos7 64位 PHP版本:PHP 7.0.21 Nginx版本:1.8.1 MySQL版本:5.5.17 注:1.所有安装都必须放在 /usr/local/src文件夹下 2.添加 ...
- centos7 安装lnmp环境
准备工作 一.配置防火墙 vim /etc/sysconfig/iptables 开启80端口.3306.22端口 -A INPUT -m state --state NEW -m tcp -p tc ...
- CentOS 7 安装phpredis和redis(接上一篇centos7安装lnmp)
一.安装扩展phpredis 1.PHP7 安装redis 扩展phpredis cd /root/software wget https://github.com/edtechd/phpredis/ ...
- centos7 安装LNMP(php7)之php7.0 yum安装
http://www.jianshu.com/p/35f21210668a 安装过程参考上面的网址
随机推荐
- CentOS 6.5 下源码搭建LAMP环境
参考网站: http://wenku.baidu.com/link?url=Cvkqss2E9mnxXOZigMWPaCfqwsBxnm0sZ4aKE2oLAgQ888XxeC0DWOChxVqiHz ...
- [转]python实现RESTful服务(基于flask)
python实现RESTful服务(基于flask) 原文: https://www.jianshu.com/p/6ac1cab17929 前言 上一篇文章讲到如何用java实现RESTful服务, ...
- Winform 界面全屏 显示状态栏
this.FormBorderStyle = FormBorderStyle.None; this.MaximumSize = new Size(Screen.PrimaryScreen.Workin ...
- WPF Demo18 路由事件
using System.Windows; namespace 路由事件2 { public class Student { ////声明并定义路由事件 //public static readonl ...
- 持续集成(Continuous Integration)基本概念与实践
本文由Markdown语法编辑器编辑完成. From https://blog.csdn.net/inter_peng/article/details/53131831 1. 持续集成的概念 持续集成 ...
- 【maven】之使用import scope解决maven继承(单)问题
想必大家在做SpringBoot应用的时候,都会有如下代码: <parent> <groupId>org.springframework.boot</groupId> ...
- 使用jquery.mCustomScrollbar自定义滚动条(4)live使用,向未来元素添加滚动条,不实用,了解一下
.div_box元素是本来没有的,在滚动条初始化的时候方法是加在$('.content .div_box').mCustomScrollbar()上面,参数live:on; 点击按钮的时候,进行con ...
- appium 启动了2个端口,但是只有一台机器在跑的 问题解决 (还没试,记录在此)
appium启动了2个,端口分别设置为了4723 4725, 在测试类中也分别指定了设备和端口,用device来指定.然而每次都是运行一个设备. 后来添加了udid这个来指定才发现可以.deviceN ...
- 1136 A Delayed Palindrome (20 分)
Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 ...
- go语言学习--go的临时对象池--sync.Pool
一个sync.Pool对象就是一组临时对象的集合.Pool是协程安全的. Pool用于存储那些被分配了但是没有被使用,而未来可能会使用的值,以减小垃圾回收的压力.一个比较好的例子是fmt包,fmt包总 ...