server模块
由于这次只是学习server模块的配置,所以upstream模块的信息没有提供在文档中。以下配置中proxy_pass http:// 后的字段,为配置文件中配置的upstream名称。
server {
listen 80;
listen 443 ssl;
ssl_certificate /app/tengine/conf/key/test.pem;
ssl_certificate_key /app/tengine/conf/key/test.key;
add_header Cache-Control no-cache;
add_header Cache-Control private;
add_header X-Frame-Options SAMEORIGIN;
server_name localhost;
location /status {
check_status;
access_log off;
}
location ^~ /stock {
proxy_pass http://stock;#对应upstream未提供在文档中
proxy_method GET;
error_page 405 =200 http://127.0.0.1/$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_heade