好物优选点击查看详情 京东购买

暂无内容

Ubuntu Server 20.04.2 LTS安装配置

Ubuntu Server 20.04.2 LTS安装配置

1.选择English

2.选择Continue without updating

3.Done

4.Done

5.Done

6.Mirror address: http://mirrors.aliyun.com/ubuntu

7.Done

8.Done Continue

9.输入账号密码

10.空格选择 Install OpenSSH server

11.Done

12.reboot

sudo apt-get update sudo apt-get install openjdk-11-jdk 

1、apt-get安装nginx

 sudo su root apt-get install nginx  nginx -v  service nginx start 

2、解压手动安装nginx

卸载apt-get安装的nginx

 apt-get --purge autoremove nginx  nginx -v 

安装依赖包

sudo apt-get install gcc libpcre3 libpcre3-dev libpcrecpp0v5 libssl-dev zlib1g-dev 

http://nginx.org/en/download.html

下载Nginx

 sudo tar -xzvf nginx-1.19.10.tar.gz 

编译nginx

 cd /usr/local/nginx-1.19.10  ./configure  make  make install 

启动nginx

  cd /usr/local/nginx/sbin  ./nginx 

配置web

server { listen 9003; server_name localhost; location / { root /var/www/hello/webs; index index.html; autoindex on; set $fallback_file /index.html; if ($http_accept !~ text/html) { set $fallback_file /null; } if ($uri ~ /$) { set $fallback_file $uri; } try_files $uri $fallback_file; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 

启动/关闭/重启

./nginx ./nginx -s stop ./nginx -s reload 

services

hello.sh

#!/bin/bash  APP_NAME=/var/www/hello/services/hello.jar  LOG_FILE=/var/www/hello/services/hello.log  port=6000 pid=$(netstat -nlp |grep :$port | awk '{print $7}' | awk -F"/" '{print $1}'); kill -9 $pid echo "$pid进程终止成功" sleep 2  if test -e $APP_NAME then echo '文件存在,开始启动此程序...'  nohup java -jar $APP_NAME >> $LOG_FILE 2>&1 &  tail -f $LOG_FILE   else echo '$APP_NAME 文件不存在,请检查。' fi 
 sudo ufw status  sudo ufw enable  sudo ufw disable  sudo ufw allow 8080  sudo ufw delete allow 8080  sudo ufw reload 

原文链接:https://blog.csdn.net/chinaxsw/article/details/117523530

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享