主要內(nèi)容
1.后臺運(yùn)行jar
2.nginx安裝配置
將springboot項(xiàng)目打包成jar就不概述了。
- 后臺運(yùn)行jar拨拓,使用命令
nohup java -jar ....jar &
nohup java -jar ....jar >temp.text &
第一種轮傍,默認(rèn)輸出到nohup.out文件,第二種為指定輸出文件不同。
- 查看端口占用情況,使用kill -9 進(jìn)程id,可殺死進(jìn)程。
netstat -nlp |grep :8080
- Nginx安裝
需要先安裝依賴
yum -y install gcc gcc-c++溶耘;
yum -y install pcre-devel zlib-devel openssl-devel
安裝nginx
wget -P /usr/temp http://nginx.org/download/nginx-1.15.1.tar.gz
tar -zxvf nginx-1.15.1.tar.gz
cd nginx-1.15.1
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
啟動nginx
cd /usr/local/nginx/sbin
./nginx -s reload
配置代理
vi /usr/nginx/conf/nginx.conf
添加如下內(nèi)容 /api/ 根據(jù)你自己的情況定二拐,IP也是
location /api/ {
proxy_pass http://0.0.0.0:8080;
}
如上,會轉(zhuǎn)發(fā)到http://0.0.0.0:8080/api/