-
-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
反向代理怎么实现的? #6
Comments
server {
listen 80;
listen 443 ssl;
server_name api.surmon.me;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
ssl_session_tickets on;
resolver 114.114.114.114 114.114.115.115 8.8.8.8 valid=300s;
resolver_timeout 10s;
ssl_certificate /usr/local/wwwcert/api.surmon.me/xxxxxx.pem;
ssl_certificate_key /usr/local/wwwcert/api.surmon.me/xxxxxx.key;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000";
add_header X-Frame-Options deny;
# add_header Cache-Control no-cache;
# add_header Pragma no-cache;
# add_header Expires 0;
location / {
etag on;
# expires off;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
}
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
access_log off;
error_log /usr/local/wwwlogs/nginx/nodepress.error.log;
} |
# 代理服务
location ~ "^/proxy/(.*)$" {
resolver 114.114.114.114 114.114.115.115 8.8.8.8 valid=300s;
resolver_timeout 10s;
proxy_pass http://$1;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
expires 7d;
} |
非常感谢!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
最好可以贴下配置文件
The text was updated successfully, but these errors were encountered: