docker
default.conf
server {
listen 9784;
server_name localhost;
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log error;
gzip on;
gzip_min_length 100k;
gzip_buffers 4 16k;
gzip_comp_level 8;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~/api/ {
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_set_header X-NginX-Proxy true;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://192.168.8.146:8888;
}
location ^~/portalIcon/ {
rewrite ^/portalIcon/(.*)$ /$1 break;
proxy_pass http://192.168.8.146:9000;
}
location ^~/smartbi/ {
proxy_pass http://192.168.8.138:18080;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
docker-compose.yml
version: "3"
services:
portal-web:
image: nginx
container_name: portal-web
ports:
- "9784:9784"
volumes:
- /docker-opt/web/portal-web/dist/:/usr/share/nginx/html/
- /docker-opt/web/portal-web/default.conf:/etc/nginx/conf.d/default.conf
restart: always
异乡小龟