代码拉取完成,页面将自动刷新
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main 'server="$server_name" host="$host” dest_port="$server_port"'
#'src="$remote_addr" ip="$realip_remote_addr" user="$remote_user" '
'time_local="$time_local" http_status="$status" '
'http_referer="$http_referer" http_user_agent="$http_user_agent" '
'http_x_forwarded_for="$http_x_forwarded_for" '
'http_x_header="$http_x_header" uri_query="$query_string" uri_path="$uri" '
'request=$request http_method="$request_method" ';
access_log /var/log/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
#设置resolver为coredns的地址,kubectl get svc -n kube-system -o wide
resolver 10.96.0.10 valid=10s ipv6=off;
resolver_timeout 10s;
server {
listen 80;
#测试环境主机ip地址作为host,未来还会改成ingress域名访问
server_name mybookstore-dev.my-site.com;
#动静分离
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#使用集群内的mybookstore-app-svc服务,利用k8s的service域名解析和k8s的service的负载均衡能力,将压力分散到应用层的各个pod中
location /api/ {
set $backend mybookstore-app-svc.dev.svc.cluster.local;
proxy_pass http://$backend:5000;
}
#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;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。