1.nginx安装与配置

1.1安装nginx

//创建系统用户nginx
[root@localhost ~]# useradd -r -M -s /sbin/nologin nginx //安装依赖环境
[root@localhost ~]# yum -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++
[root@localhost ~]# yum -y groups mark install 'Development Tools' //创建日志存放目录
[root@localhost ~]# mkdir -p /var/log/nginx
[root@localhost ~]# chown -R nginx.nginx /var/log/nginx //下载nginx
[root@localhost src]# wget http://nginx.org/download/nginx-1.12.0.tar.gz
[root@localhost src]# ls
debug kernels nginx-1.12.0.tar.gz //编译安装
[root@localhost src]# tar xf nginx-1.12.0.tar.gz -C /usr/local/
[root@localhost src]# cd /usr/local/
[root@localhost local]# ls
bin etc games include lib lib64 libexec nginx-1.12.0 sbin share src
[root@localhost local]# cd nginx-1.12.0/
[root@localhost 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@localhost nginx-1.12.0]# make && make install

1.2nginx安装后的配置

//配置环境变量
[root@localhost ~]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@localhost ~]# . /etc/profile.d/nginx.sh //启动nginx
[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.0.0.1:25 *:*
LISTEN 0 25 *:514 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 25 :::514 :::*

//网站访问

2.mysql安装与配置

2.1安装mysql

//安装依赖包
[root@localhost ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel //创建用户和组
[root@localhost ~]# groupadd -r -g 306 mysql
[root@localhost ~]# useradd -r -M -s /sbin/nologin -g 306 -u 306 mysql //下载二进制格式的mysql软件包
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget https://downloads.mysql.com/archives/get/file/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz //解压软件至/usr/local/
[root@localhost src]# ls
debug kernels mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
[root@localhost src]# tar xf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@localhost src]# cd /usr/local/
[root@localhost local]# ls
bin games lib libexec nginx sbin src
etc include lib64 mysql-5.7.22-linux-glibc2.12-x86_64 nginx-1.12.0 share
[root@localhost local]# ln -sv mysql-5.7.22-linux-glibc2.12-x86_64/ mysql
"mysql" -> "mysql-5.7.22-linux-glibc2.12-x86_64/"
[root@localhost local]# ls
bin games lib libexec mysql-5.7.22-linux-glibc2.12-x86_64 nginx-1.12.0 share
etc include lib64 mysql nginx sbin src //修改目录/usr/local/mysql的属主属组
[root@localhost ~]# chown -R mysql.mysql /usr/local/mysql
[root@localhost ~]# ll /usr/local/mysql -d
lrwxrwxrwx 1 mysql mysql 36 Aug 14 16:00 /usr/local/mysql -> mysql-5.7.22-linux-glibc2.12-x86_64/ //添加环境变量
[root@localhost ~]# ls /usr/local/mysql
bin COPYING docs include lib man README share support-files
[root@localhost ~]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost ~]# . /etc/profile.d/mysql.sh
[root@localhost ~]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin //建立数据存放目录
[root@localhost mysql]# mkdir /opt/data
[root@localhost mysql]# chown -R mysql.mysql /opt/data/
[root@localhost mysql]# ll /opt/
total 0
drwxr-xr-x 2 mysql mysql 6 Aug 14 16:54 data //初始化数据库
[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2020-01-08T01:17:10.279568Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-01-08T01:17:10.746049Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-01-08T01:17:10.804979Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-01-08T01:17:10.899793Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 98673ab3-31b4-11ea-bcca-000c2900526e.
2020-01-08T01:17:10.900504Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-01-08T01:17:10.901585Z 1 [Note] A temporary password is generated for root@localhost: RD8RvivKwK%+
[root@localhost ~]# echo 'RD8RvivKwK%+' > /root/pass
[root@localhost ~]# cat /root/pass
RD8RvivKwK%+

2.2mysql配置

//配置mysql
[root@localhost ~]# ln -sv /usr/local/mysql/include/ /usr/local/include/mysql
‘/usr/local/include/mysql’ -> ‘/usr/local/mysql/include/’
[root@localhost ~]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
[root@localhost ~]# ldconfig //生成配置文件
[root@localhost ~]# cat > /etc/my.cnf <<EOF
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
EOF //配置服务启动脚本
[root@localhost ~]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@localhost ~]# sed -ri 's#^(datadir=).*#\1/opt/data#g' /etc/init.d/mysqld //启动mysql
[root@localhost ~]# service mysqld start
Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'.
SUCCESS!
[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.0.0.1:25 *:*
LISTEN 0 25 *:514 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 25 :::514 :::*
LISTEN 0 80 :::3306 :::* //修改密码
//使用临时密码登录
[root@localhost ~]# cat /root/pass
RD8RvivKwK%+
[root@localhost ~]# mysql -uroot -p'RD8RvivKwK%+'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> //设置新密码
mysql> set password = password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> quit
Bye

3.部署tomcat

3.1java环境安装

//安装jdk环境
[root@localhost ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel //查看安装的版本
[root@localhost ~]# java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

3.2tomcat部署

//下载tomcat
[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.30.tar.gz //解压部署
[root@localhost src]# ls
apache-tomcat-9.0.30.tar.gz debug kernels mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz nginx-1.12.0.tar.gz
[root@localhost src]# tar xf apache-tomcat-9.0.30.tar.gz -C /usr/local/
[root@localhost src]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.30 etc include lib64 mysql nginx sbin src
bin games lib libexec mysql-5.7.22-linux-glibc2.12-x86_64 nginx-1.12.0 share
[root@localhost local]# ln -s apache-tomcat-9.0.30/ tomcat
[root@localhost local]# ls
apache-tomcat-9.0.30 games lib64 mysql-5.7.22-linux-glibc2.12-x86_64 sbin tomcat
bin include libexec nginx share
etc lib mysql nginx-1.12.0 src //写一个hello world的java页面
[root@localhost ~]# vim index.jsp <html>
<head>
<title>test page</title>
</head>
<body>
<%
out.println("Hellow World");
%>
</body>
</html>
[root@localhost ~]# mkdir /usr/local/tomcat/webapps/test
[root@localhost ~]# cp index.jsp /usr/local/tomcat/webapps/test/ //启动tomcat
[root@localhost ~]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[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.0.0.1:25 *:*
LISTEN 0 25 *:514 *:*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 25 :::514 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
LISTEN 0 100 :::8009 :::*
LISTEN 0 80 :::3306 :::*

//网站访问



4.nginx反向代理

4.1全部反代至tomcat

//修改配置文件
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
... #access_log logs/host.access.log main; location / {
proxy_pass http://127.0.0.1:8080;
} #error_page 404 /404.html; ....
[root@localhost ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost ~]# nginx -s stop
[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.0.0.1:25 *:*
LISTEN 0 25 *:514 *:*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 25 :::514 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
LISTEN 0 100 :::8009 :::*
LISTEN 0 80 :::3306 :::*

//网站访问



4.2动静分离

//修改配置文件
[root@localhost test]# vim /usr/local/nginx/conf/nginx.conf
...
#access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
}
location ~* \.(jsp|do)$ {
proxy_pass http://127.0.0.1:8080;
} #error_page 404 /404.html;
...
[root@localhost html]# ls
1.jpg 50x.html index.html
[root@localhost test]# nginx -s stop
[root@localhost test]# nginx
[root@localhost test]# 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 25 *:514 *:*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 25 :::514 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
LISTEN 0 100 :::8009 :::*
LISTEN 0 80 :::3306 ::

//网站访问



5.部署jenkins

//下载jenkins
[root@localhost ~]# ls
anaconda-ks.cfg index.jsp jenkins.war pass //部署jenkins
[root@localhost ~]# cp jenkins.war /usr/local/tomcat/webapps/
[root@localhost ~]# cd /usr/local/tomcat/webapps/
[root@localhost webapps]# ls
docs examples host-manager jenkins jenkins.war manager ROOT test
[root@localhost webapps]# cd jenkins
[root@localhost jenkins]# ls
bootstrap help LogFileOutputStream.class META-INF
ColorFormatter.class images Main.class robots.txt
css JNLPMain.class MainDialog$1$1.class scripts
dc-license.txt jsbundles MainDialog$1.class WEB-INF
executable LogFileOutputStream$1.class MainDialog.class winstone.jar
favicon.ico LogFileOutputStream$2.class Main$FileAndDescription.class

//网站访问

lnmt的更多相关文章

  1. Tomcat相关的LNMT和LAMT

    Tomcat相关的LNMT和LAMT LNMT:Linux Nginx MySQL Tomcat Client (http) --> nginx (reverse proxy)(http) -- ...

  2. Tomcat负载均衡、调优核心应用进阶学习笔记(三):LNMT nginx+tomcat、LAMT apache+tomcat、session会话保持、不错的站点

    文章目录 LNMT nginx+tomcat LAMT apache+tomcat 基于mod_proxy 单节点 配置基于mod_proxy的负载均衡 基于mod_jk(需要编译安装) 单节点 配置 ...

  3. 09 . Nginx配置LNMP和LNMT架构

    安装LNMP架构 环境清单 list CentOS7.3 proxysql-2.0.12-1-centos7.x86_64.rpm mysql-5.7.23-1.el7.x86_64.rpm-bund ...

  4. 手动部署LNMT(Nginx+Tomcat)并实现Nginx反向代理Tomcat

    一.什么是Tomcat? 在弄清楚Tomcat之前要先了解什么是J2EE:从整体上讲,J2EE 是使用 Java 技术开发企业级应用的工业标准,它是 Java 技术不断适应和促进企业级应用过程中的产物 ...

  5. LNMT(Linux+Nginx+MySQL+Tomcat)常见性能参数调优

  6. 10.1、LNMT架构

      Java环境安装包下载路径: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htm ...

  7. tomcat安装配置.md

    tomcat 安装 安装jdk jdk我使用的是oracle的,如果下载请在oracle的官网上下载.或者你也可以使用openjdk,官网在http://openjdk.java.net/. # ta ...

  8. tomcat学习笔记2

    LNMT在网站架构中的实现过程: Client --> http --> Nginx --> reverse_proxy (http) --> tomcat (http con ...

  9. PHP环境配置综合篇

    1.WNMP: http://www.wnmp.com.cn/     En: https://www.getwnmp.org/ 2.xampp:https://www.apachefriends.o ...

随机推荐

  1. Windows玩转Kubernetes系列4-搭建K8S Dashboard

    下载官方yaml文件 最新的配置文件v2.0.0-beta8版本recommended.yaml,UI地址 wget https://raw.githubusercontent.com/kuberne ...

  2. 曼孚科技:AI语音交互领域常用的4个术语

    ​语音交互是基于语音输入的新一代交互模式,比较典型的应用场景是各类语音助手. 本文整理了语音交互领域常用的4个术语,希望可以帮助大家更好地理解这门学科. 1. 语音合成标记语言(SSML) 语音合成标 ...

  3. 技术之心 | 云信和TA们携手打响防疫战

      1月27日,教育部发布<关于2020年春季学期延期开学的通知>,各地高等院校.中小学.幼儿园纷纷推迟开学.疫情当前,学生们的鼠年寒假变得无比漫长. 网易云信众多教育客户以行动践行教育的 ...

  4. Android_下方弹出菜单的实现

    这一功能要用到动画相关知识 实现点击按钮弹出下方输入框,这里点击可弹出一个输入界面,其中包括一个小型计算器. 点击date可弹出datedialog设置date. 1.编写弹出框的布局文件 <? ...

  5. Pikachu-php反序列化

    在理解这个漏洞前,你需要先搞清楚php中serialize(),unserialize()这两个函数. 序列化serialize()序列化说通俗点就是把一个对象变成可以传输的字符串,比如下面是一个对象 ...

  6. 2019.2.21 T2题解

    meet 大概思路就是 , 找出相交的路径 , 判断方向 , 分类讨论.. 假设已经找出了相交路径 ... 若方向相同 , 则找到相交路径上边权的最大值 , 若最大值>出发时间差 , 则可行. ...

  7. C++-HDU3400-Line belt[三分]

    将军饮马问题的升级版 二维平面中要从A到D,给出两条线段AB,CD,分别在线段AB,CD,以及空白处的速度为P,Q,R 求最少用时 由于最优位置满足“凸性”,且两条线段可以等价,所以可以采取三分答案迭 ...

  8. java打印出某一指定路径下的文件夹内的所有子文件夹和文件,并区分开来

    public class printoutFile { public static void main(String[] args) { printFile(new File("D:\\te ...

  9. SVM-支持向量机(二)非线性SVM分类

    非线性SVM分类 尽管SVM分类器非常高效,并且在很多场景下都非常实用.但是很多数据集并不是可以线性可分的.一个处理非线性数据集的方法是增加更多的特征,例如多项式特征.在某些情况下,这样可以让数据集变 ...

  10. layer.open获取弹出层的input框的值

    使用top.$('#txtReason').val();获取值: //不通过 function unAuditData(id) { parent.layer.open({ type: , title: ...