一、安装nginx
1、y革命先烈的英雄事迹um安装nginx
yum -y install nginx
2、检查nginx的状态,开启nginx和开机自启
(1)检查nginx的状态
systemctl status nginx
(2)启动nginx
systemctl start nginx
(3)开机自启nginx
systemctl enable nginx
3、配置nginx访问日志(可不配置)
(1)创建存放目录
mkdir -p /www/app/nginx/log/access/
mkdir -p /www/app/nginx/log/error/
chmod 777 -r /www
(2)配置nginx日志格式(找到左边的字段,修改右边信息)
vim /etc/nginx/nginx.conf
error_log /www/app/nginx/log/error/error.log;log_format main '"$rver_name" "$rver_addr:$rver_port" "$remote_addr" "$time_local" "$request_method" "$request_uri" "$rver_protocol" "$status" "$request_time" "$bytes_nt" "$body_bytes_nt" "$http_range" "$http_referer" "$http_ur_agent" "$request_body" "$request_completion"';access_log /www/app/nginx/log/access/access.log main;
二、安装mysql5.7
1、下载yum repository,然后安装(大概25k左右)
mkdir /download
cd /download/
wget http://dev.mysql.com/get/mysql57-community-relea-el7-10.noarch.rpm
yum -y install mysql57-community-relea-el7-10.noarch.rpm
2、安装mysql5.7
yum -y install mysql-community-rver
3、启动mysql,以及开机自启
启动
systemctl start mysqld
开机自启
systemctl enable mysqld
4、修改密码
(1)获取初始密码
cat /var/log/mysqld.log |grep password
(2)登录(用上面的密码)
mysql -uroot -p
(3)修改密码
alter ur ‘root’@’localhost’ identified by ‘123456’;
密码太多简单,不符合策略,则使用复杂一点的密码
alter ur ‘root’@’localhost’ identified by ‘123456abc#’;
(4)、若是密码过于复杂,难记,则修改密码策略,再修改一个简单的密码(正式环境不建议使用)
修改策略
t global validate_password_length=4;
t global validate_password_policy=0;
查看策略
show variables like ‘validate_password%’;
修改密码
alter ur ‘root’@’localhost’ identified by ‘123456’;
三、安装php7.2
1、下载php7.2(19m左右)
cd /download
wget https://www.php.net/distributions/php-7.2.24.tar.gz
解压
关于春节的习俗tar zxvf php-7.2.24.tar.gz
cd php-7.2.24
2、安装依赖组件
yum -y install gcc gcc-c++ libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurs curl gdbm-devel db4-devel libxpm-devel libx11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-从面相看女人devel
3、编译安装
./configure \--prefix=/usr/local/php \--w叶绍翁ith-config-file-path=/etc \--enable-fpm \--with-fpm-ur=nginx \--with-fpm-group=nginx \--enable-inline-optimization \--disable-debug \--disable-rpath \--enable-shared \--enable-soap \--with-libxml-dir \--with-xmlrpc \--with-openssl \--with-mhash \--with-pcre-regex \--with-sqlite3 \--with-zlib \--enable-bcmath \--with-iconv \--with-bz2 \--enable-calendar \--with-curl \--with-cdb \--enable-dom \--enable-exif \--enable-fileinfo \--enable-filter \--with-pcre-dir \--enable-ftp \--with-gd \--with-openssl-dir \--with-jpeg-dir \--with-png-dir \--with-zlib-dir \--with-freetype-dir \--enable-gd-jis-conv \--with-gettext \--with-gmp \--with-mhash \--enab台风和飓风的不同点在于le-json \--enable-mbstring \--enable-mbregex \--enable-mbregex-backtrack \--with-libmbfl \--with-onig \--enable-pdo \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-zlib-dir \--with-pdo-sqlite \--with-readline \--enable-ssion \--enable-shmop \--enable-simplexml \--enable-sockets \--enable-sysvmsg \--enable-sysvm \--enable-sysvshm \--enable-wddx \--with-libxml-dir \--with-xsl \--enable-zip \--enable-mysqlnd-compression-support \--with-pear \--enable-opcache
4、make && make install
5、拷贝php.ini
cp /download/php-7.2.24/php.ini-development /etc/php.ini
6、php-fpm的配置与使用
(1)复制php-fpm.conf
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
(2)复制www.conf
cd/usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf
(3)php-fpm系统服务
vi /etc/systemd/system/php-fpm.rvice
[unit]description=php-fpmafter=network.target[rvice]type=forkingexecstart=/usr/local/php/sbin/php-fpmprivatetmp=true[install]wantedby=multi-ur.target
(4)启动php-fpm跟开机自启
systemctl start php-fpm
systemctl enable php-fpm
本文发布于:2023-04-08 10:54:13,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/dd86059159d6a107a39cde985c30922d.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:CentOS7搭建LNMP.doc
本文 PDF 下载地址:CentOS7搭建LNMP.pdf
留言与评论(共有 0 条评论) |