启动命令:
docker run -d -p 80:80 --name nginx -v `pwd`/logs:/etc/nginx/logs -v /root/nginx/nginx.conf:/etc/nginx/nginx.conf:ro --label aliyun.logs.catalina=stdout --label aliyun.logs.access=/etc/nginx/logs/*.log 172.16.101.43:5000/bootcsp_nginx:1.0.0
nginx.conf配置:
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main
# '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
'$remote_user [$time_local] $http_x_Forwarded_for $remote_addr $request '
'$http_x_forwarded_for '
'$upstream_addr '
'ups_resp_time: $upstream_response_time '
'request_time: $request_time';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream 172.18.101.98{
server 172.18.101.97:8080;
}
upstream ucc{
server 172.18.100.141:8887;
server 172.18.100.151:8887;
server 172.18.100.223:8887;
}
server {
listen 8887;
server_name localhost;
location / {
root html;
index index.html index.htm;
proxy_pass http://ucc;
}
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
proxy_pass http://172.18.101.98;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#location ^~ /fintech-app/{
# 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://fintech-app;
#}
#location ^~ /api/{
# rewrite ^/api/(.*)$ /$1 break;
# proxy_pass http://fintech-app;
#}
}
}
---------------------
【转载,仅作分享,侵删】
作者:javaDocker
原文:https://blog.csdn.net/chen978616649/article/details/81063496
版权声明:本文为博主原创文章,转载请附上博文链接!
|
|