nginx配置示例
(2022-03-23 13:16:50)分类: 运维管理 |
upstream backend-test-micro {
server
192.168.0.180:18081;
}
server {
listen
443 ssl;
server_name test.sdsd.com;
ssl_certificate /etc/nginx/ssl/test.sdsd.com.pem;
ssl_certificate_key /etc/nginx/ssl/test.sdsd.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers
HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#charset
koi8-r;
#access_log
/var/log/nginx/host.access.log main;
location /
{
root /usr/share/nginx/health;
index index.html
index.htm;
}
location
/api/ {
#root
/usr/share/nginx/home;
#index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend-test-micro/;
}
#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;
}
# proxy the
PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~
\.php$ {
#
proxy_pass
http://127.0.0.1;
#}
}
}
server {
}
前一篇:管理心得20220322
后一篇:苏轼《定风波·莫听穿林打叶声》