LNMP架构搭建编译安装详细部署

LNMP架构搭建编译安装详细部署

环境准备

关闭防火墙和SElinux

[root@yxr ~]# systemctl stop firewalld
[root@yxr ~]# systemctl disable firewalld
[root@yxr ~]# sed -ri 's/(SELINUX=).*/\1disabled/g' /etc/selinux/config
[root@yxr ~]# setenforce 0

安装nginx

创建系统用户nginx
[root@yxr ~]# useradd -r -M -s /sbin/nologin nginx

安装依赖环境
[root@yxr ~]# yum -y install pcre-devel openssl openssl-devel gd-devel
[root@yxr ~]# yum -y groups mark install 'Development Tools'

创建日志存放目录
[root@yxr ~]# mkdir -p /var/log/nginx
[root@yxr ~]# chown -R nginx.nginx /var/log/nginx

下载nginx
[root@yxr ~]# cd /usr/src/
[root@yxr src]# yum -y install wget
[root@yxr src]# wget http://nginx.org/download/nginx-1.12.0.tar.gz
[root@yxr src]# ls
debug  kernels  nginx-1.12.0.tar.gz
[root@yxr src]# tar xf nginx-1.12.0.tar.gz 
[root@yxr src]# cd nginx-1.12.0/
[root@yxr nginx-1.12.0]# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-debug \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log
[root@yxr nginx-1.12.0]# make -j $(grep 'processor' /proc/cpuinfo | wc -l) && make install

nginx安装后配置环境变量
[root@yxr nginx-1.12.0]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@yxr nginx-1.12.0]# . /etc/profile.d/nginx.sh

启动nginx
[root@yxr nginx-1.12.0]# nginx
[root@yxr nginx-1.12.0]# ss -antl
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN      0      128     *:80                  *:*                  
LISTEN      0      128     *:22                  *:*                  
LISTEN      0      100    127.0.0.1:25                  *:*                  
LISTEN      0      128    :::22                 :::*                  
LISTEN      0      100       ::1:25                 :::*                  

安装mysql

安装依赖包
[root@yxr nginx-1.12.0]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel

创建用户和组
[root@yxr nginx-1.12.0]# groupadd -r -g 306 mysql
[root@yxr nginx-1.12.0]
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值