- docker-compose.yml
version: '3.1'
services:
nginx:
image: nginx
container_name: nginx
privileged: true
restart: always
ports:
- 80:80
volumes:
- /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- /opt/nginx/logs:/var/log/nginx
- /opt/nginx/html:/usr/share/nginx/html
- /opt/nginx/cert/:/etc/nginx/cert/
- nginx.conf
vim /opt/nginx/conf/nginx.conf
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream gateway.daqing.zhongxinda.top {
server 172.26.191.107:7777 weight=1; #此处ip为服务器内网IP,端口号为tomcat端口号
#server 172.26.191.108:7777 weight=1; #此处ip为服务器内网IP,端口号为tomcat端口号
}
server {
listen 80;
server_name api;
location /prod-api/ {
proxy_pass http://gateway.daqing.zhongxinda.top/;
}
location /daqing/ {
proxy_pass http://gateway.daqing.zhongxinda.top/;
}
location / {
root /usr/share/nginx/html/daqing/dist;
try_files $uri $uri/ @router;
index index.html index.htm;
expires 30d; #缓存30天
}
location @router {
rewrite ^.*$ /index.html last;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。