安装nginx,使用下面网站的方式一
链接
添加配置
cd/etc/nginx/conf.d
vi api.conf
server {
listen 80;#监听端口
root /usr/******/springboot/static/; #网站根目录,建议使用绝对路径
index index.php index.html index.htm; #默认文件
location / {
root /usr/******/springboot/static/;
index index.html index.htm index.php;
}
}
server {
server_name ;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
:wq!
上面就是80端口开始一个网站,代理到8080服务
重启服务
systemctl restart nginx
访问页面
访问服务