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 安装过程参考上面的网址
随机推荐
- GBT27930-2015电动汽车非车载传导式充电机与电池管理系统之间的通信协议
本标准规定了电动汽车非车载传导式充电机(简称充电机)与电池管理系统(Battery Management System,简称BMS)之间基于控制器局域网(Control Area NetWork,简称 ...
- ML平台_微博深度学习平台架构和实践
( 转载至: http://www.36dsj.com/archives/98977) 随着人工神经网络算法的成熟.GPU计算能力的提升,深度学习在众多领域都取得了重大突破.本文介绍了微博引入深度学 ...
- SPI初识
SPI初识 1.信息来源 2.需要了解的是SPI(x1,x2,x4)
- Ubuntu 14.04 正式版 12.4
安装Ubuntu 14.04后要做的5件事情 4月17日,开源免费系统Ubuntu官方正式宣布发布Ubuntu 14.04 LTS(代号Trusty Tahr)正式版.官方声称该版本主打云计算,在云平 ...
- InfluxDB 的UTC时间问题与简单的持续查询语句
原文:https://blog.csdn.net/Vblegend_2013/article/details/80904275 最近项目中使用了时序数据库InfluxDB 各方性能也是蛮强大的.但是唯 ...
- Mysql binlog日志的介绍
mysql的复制功能是 大规模,高性能应用的基础. 分担读负载.水平扩展 是通过二进制日志进行复制,是异步的. 只记录成功执行的修改事件,出现错误的和回滚的是不会纪录的. 日志路径 查看日志 RO ...
- ALGO-119_蓝桥杯_算法训练_寂寞的数
问题描述 道德经曰:一生二,二生三,三生万物. 对于任意正整数n,我们定义d(n)的值为为n加上组成n的各个数字的和.例如,d()=++=, d()=++++=. 因此,给定了任意一个n作为起点,你可 ...
- python调用有道翻译api实现翻译
通过调用有道翻译的api,实现中译英.其他语言译中文 代码: # coding=utf-8 import urllib import urllib2 import json import time i ...
- ubuntu安装最新的mercurial
Mercurial 是一种轻量级分布式版本控制系统,采用 Python 语言实现,易于学习和使用,扩展性强 之前安装的mercurial版本(2.8.2)太老了,想安装最新版本的. 网上搜到方法 su ...
- csv文件操作
1.python2中: import csv infos = [ ['peter','male'], ['marry','female'], ['johon','male'], ['rose','fe ...