jeecgboot nginx 配置
时间: 2023-10-09 15:03:12 浏览: 76
Jeecgboot是一个基于Spring Boot的快速开发平台,而Nginx是一个流行的开源反向代理服务器。在将Jeecgboot部署到Nginx上时,需要配置Nginx以正确地将HTTP请求转发给Jeecgboot服务器。
首先,在Nginx的配置文件中,一般是`/etc/nginx/nginx.conf`,找到`http`块,在其中添加一个新的`server`块来配置Jeecgboot的代理。
```
http {
server {
listen 80; # 监听的端口号
server_name example.com; # Jeecgboot服务器的域名或IP地址
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080; # Jeecgboot服务器的地址和端口号
proxy_redirect off;
}
}
}
```
其中,`listen`指定Nginx监听的端口号,`server_name`指定Jeecgboot服务器的域名或IP地址。在`location /`块中,`proxy_pass`将请求转发给Jeecgboot服务器,默认是`http://localhost:8080`,可以根据实际情况修改。
配置完成后,保存并退出Nginx的配置文件。然后,重新加载Nginx配置,通过执行命令`sudo nginx -s reload`。
通过以上配置,Nginx将会将来自80端口的HTTP请求转发给Jeecgboot服务器。这样可以通过访问`http://example.com`来访问Jeecgboot应用程序。