lnmt架构搭建
环境说明:
系统平台 | 安装的服务 |
---|---|
centos7、redhat7 | nginx-1.16.1、mysql-5.7、tomcat |
1.安装nginx服务
1.首先搭建yum网络源
[root@localhost ~]# rpm -ivh http://mirror.centos.org/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# yum -y install epel-release vim
2.安装开发工具包
[root@localhost ~]# yum groups mark install 'Development Tools'
3.创建nginx组和用户
[root@localhost ~]# groupadd -r nginx
[root@localhost ~]# useradd -r -M -s /sbin/nologin -g nginx nginx
4.安装依赖包
[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ gd-devel
5.下载nginx包并解压(到/usr/local目录中)
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@localhost src]# ls
debug kernels nginx-1.16.1.tar.gz
[root@localhost src]# tar xf nginx-1.16.1.tar.gz -C /usr/local/
[root@localhost src]# cd /usr/local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec nginx-1.16.1 sbin share src
6.编译安装
[root@localhost local]# cd nginx-1.16.1/
[root@localhost nginx-1.16.1]# ./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@localhost nginx-1.16.1]# make -j $(grep 'processor' /proc/cpuinfo | wc -l) && make install
8. 配置环境变量并启动服务
[root@localhost ~]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh[root@localhost ~]# . /etc/profile.d/nginx.sh
[root@localhost ~]# nginx
[root@localhost ~]# 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.