- 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為服務(wù)器內(nèi)網(wǎng)IP热芹,端口號為tomcat端口號
#server 172.26.191.108:7777 weight=1; #此處ip為服務(wù)器內(nèi)網(wǎng)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;
}
}
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者