tomcat

1、 官网下载: https://tomcat.apache.org/
在这里插入图片描述
2、配置好环境变量 JDK_HOME,不区分大小写,tomcat要用,必须设置

3、启动方式
bin/startup.bat 双击即可,终端console会产生中文乱码,本想改文件的编码方式,但是它会自己改回去,说明被其他文件控制,找到 conf\logging.properties , 像下面这么改就行。当然不改也没有问题,也能启动tomcat就是乱码难看点

在这里插入图片描述
bin/shutdown.bat 用来关闭tomcat,网上说什么直接点×关闭不好,why天知道,网上文章一大抄,只有我自己记录的靠谱。

方式二:我觉着apache有安装服务,tomcat同为服务器,应该也有

在这里插入图片描述
显然 , 运行 service.bat install Tomcat-9 就可以了,以后直接启动服务,而不需要点击bin/startup.bat。我也没搞

然后打开浏览器访问 http://127.0.0.1:8080/

随便记录,不是很细,就这样吧


哦,还有默认8080端口,和bp冲突了,想改的话就去conf\server.xml这里改

不指定文件名的情况下,访问的先后顺序
在这里插入图片描述

nginx

目录结构

不同的安装方式,nginx 目录组织方式不同

# apt
/etc/nginx
/var/log/nginx (access.log  error.log)
/var/www/html

# compile manual
/usr/local/nginx
├── conf
│   ├── fastcgi.conf
│   ├── mime.types
│   └── nginx.conf
├── html
│   ├── 50x.html
│   └── index.html
├── logs
└── sbin/nginx

编译安装

优点:目录集中

sudo apt install libpcre3-dev zlib1g-dev libssl-dev
sudo apt install gcc make

wget https://nginx.org/download/nginx-1.24.0.tar.gz
./configure

make 
make install
/usr/local/nginx/sbin/nginx # 启动Nginx服务器

停止nginx 服务 systemctl stop nginx

apt安装

apt install -y nginx

方法3:更新apt源,下载新版nginx

sudo apt install curl gnupg2 ca-certificates lsb-release ubuntu-keyring
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" \
    | sudo tee /etc/apt/sources.list.d/nginx.list
sudo apt update
sudo apt install nginx

ssl

① The requested nginx plugin does not appear to be installed

apt install python3-certbot-nginx

② The server will not issue certificates for the identifier :: Invalid identifiers requested :: Cannot issue for “*.localhost”: Domain name does not end with a valid public suffix (TLD)
添加真实存在的域名

③ Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA. You may need to use an authenticator plugin that can do challenges over DNS.(通配符域名申请证书出现的问题)

certbot certonly -d *.example.cn --manual --preferred-challenges dns

在这里插入图片描述

证书存放路径:

Certificate is saved at: /etc/letsencrypt/live/example.cn/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/example.cn/privkey.pem
This certificate expires on 2025-06-08.

Refer:

  • https://blog.csdn.net/wan212000/article/details/128200529
  • https://www.runoob.com/http/ssl-certbot.html

更多推荐