Linux-安装Lnmp

安装PHP

#安装epel源
yum install epel-release
#安装webtatic-releaseRPM包
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
#卸载旧版本PHP
yum -y remove php*
#安装PHP
yum -y install php74 php74-php-common php74-php-devel php74-php-pecl-memcached php74-php-pecl-memcache php74-php-pecl-redis5 php74-php-embedded php74-php-opcache php74-php-xml php74-php-bcmath php74-php-gd php74-php-pdo php74-php-mbstring php74-php-cli php74-php-fpm php74-php-mysqlnd
#设为开机自启 
systemctl enable php74-php-fpm.service
#启动Php-fpm 
systemctl start php74-php-fpm.service
#查看启动状态,红色启动失败绿色启动成功 
systemctl status php74-php-fpm.service

安装Mariadb

#Yum安装Mariadb
yum install mariadb mariadb-server -y
#启动Mariadb
systemctl start mariadb
#设为开机自启
systemctl enable mariadb
#Mariadb初始化
mysql_secure_installation
#删除匿名用户?
Remove anonymous users? [Y/n] y
#禁止root远程登录
Disallow root login remotely? [Y/n] n
#删除测试数据库并访问它?
Remove test database and access to it? [Y/n] y
#现在重新加载特权表?
Reload privilege tables now? [Y/n] y

安装Openresty

#进入opt目录
cd /opt
#下载Openresty二进制文件
wget https://openresty.org/download/openresty-1.15.8.2.tar.gz
#解压压缩包
tar zxvf openresty-1.15.8.2.tar.gz
#进入到openresty-1.15.8.2/目录
cd openresty-1.15.8.2/
#准备编译参数
./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --with-luajit --with-http_gunzip_module --with-pcre --with-pcre-jit --with-http_perl_module --with-ld-opt="-Wl,-E" --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-select_module --with-poll_module --with-file-aio --with-http_degradation_module --with-libatomic --http-client-body-temp-path=/var/tmp/nginx/client_body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
#编译&安装
make&&make install

准备工作

#编辑nginx.conf配置文件
vim /usr/local/nginx/nginx.conf

#nginx.conf配置项
 location / {

            root   html;

            index  index.html index.htm index.php;

        }

 location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;

            include        fastcgi_params;

        }

#创建目录
mkdir -p /var/tmp/nginx/client_body
mkdir -p /usr/local/nginx/nginx/logs/

#检查nginx配置文件是否正确
nginx -t

#启动nginx
nginx

版权声明:
作者:江霁月
链接:https://www.jiangjiyue.com/maintenance/linux/244.html
来源:江霁月的私人小屋
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>
文章目录
关闭
目 录