centos7 下配置lnmp

CAP_Theory
• 阅读 1250

rpm -Uvh http://nginx.org/packages/cen...

安装 yum install nginx

systemctl start nginx.service

rpm -Uvh https://dl.fedoraproject.org/...

rpm -Uvh https://mirror.webtatic.com/y...

安装php yum install -y php70w php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-fpm

systemctl start php-fpm.service

增加一个nginx配置文件配置如下

server {
listen 80;
server_name test.com;
root /usr/share/nginx/html;

index index.html index.htm index.php;

charset utf-8;

location / {

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

}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;

client_max_body_size 100m;

location ~ .php$ {

fastcgi_pass   127.0.0.1:9000;   #tcp连接 还有socket连接
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include        fastcgi_params;

}

location ~* .(otf|eot|svg|ttf|woff)$ {

add_header Access-Control-Allow-Origin *;

}

location ~* ^.+.(jpg|jpeg|gif|png|swf|rar|zip|css|js|pdf|ico|html)$ {

access_log off;
expires 30d;
break;

}

location ~ /.ht {

deny all;

}
}

systemctl restart nginx

php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
​ 修改

user =nginx
​group=nginx

systemctl restart php-fpm.service

mysql
下载
wget https://dev.mysql.com/get/mys...

安装 mysql 源
yum localinstall mysql57-community-release-el7-11.noarch.rpm

yum install -y mysql-community-server

systemctl start mysqld

systemctl status mysqld

设置开机启动
shell> systemctl enable mysqld
重载所有修改过的配置文件
shell> systemctl daemon-reload

mysql 安装完成之后,生成的默认密码在 /var/log/mysqld.log 文件中。使用 grep 命令找到日志中的密码。

shell> grep 'temporary password' /var/log/mysqld.log

首次通过初始密码登录后,使用以下命令修改密码

shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须添加一个允许远程连接的帐户。或者修改 root 为允许远程连接(不推荐)
添加一个允许远程连接的帐户
mysql> GRANT ALL PRIVILEGES ON . TO 'zhangsan'@'%' IDENTIFIED BY 'Zhangsan2018!'

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
美凌格栋栋酱 美凌格栋栋酱
6个月前
Oracle 分组与拼接字符串同时使用
SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(
待兔 待兔
1年前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Wesley13 Wesley13
3年前
java中比较两个时间的差值
项目背景1.某篇文稿的发布时间是publishDate,例如:2020072118:00:41。2.现要求判断该篇文稿的发布时间是否在近30天之内。publicstaticlongdayDiff(DatecurrentDate,DatepublishDate){LongcurrentTimecurrentDat
Stella981 Stella981
3年前
KaliTools说明书+BurpSuit实战指南+SQL注入知识库+国外渗透报告
!(https://oscimg.oschina.net/oscnet/d1c876a571bb41a7942dd9752f68632e.gif"15254461546.gif")0X00KaliLinux Tools中文说明书!(https://oscimg.oschina.net/oscnet/
Wesley13 Wesley13
3年前
4. Nginx模块
Nginx官方模块1.ngx\_http\_stub\_status\_modulehttp://nginx.org/en/docs/http/ngx\_http\_stub\_status\_module.html。(https://www.oschina.net/action/GoToLink?urlhttp%3A%2
Stella981 Stella981
3年前
CentoS 7 LNMP 环境部署zabbix监控
本次实验,我们主要在centos7系统上部署zabbix监控,并实现监控交换机,监控Apache服务器,实现邮箱报警等操作LNMP环境构建软件包下载地址nginx1.8.0.tar.gzhttp://nginx.org/download/(https://www.oschina.net/action/GoToL
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
MySQL总结(十一)子查询
!(https://oscimg.oschina.net/oscnet/upa344f41e81d3568e3310b5da00c57ced8ea.png)子查询1\.什么是子查询需求:查询开发部中有哪些员工selectfromemp;通
Wesley13 Wesley13
3年前
PHP创建多级树型结构
<!lang:php<?php$areaarray(array('id'1,'pid'0,'name''中国'),array('id'5,'pid'0,'name''美国'),array('id'2,'pid'1,'name''吉林'),array('id'4,'pid'2,'n
Python进阶者 Python进阶者
1年前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这