server {
listen 80;
listen 443;
server_name www.xieboke.net xieboke.net;
charset utf-8;
client_max_body_size 50m;
ssl on;
ssl_certificate /root/yzq/djangos/blog/certificate/xiebole.net/Nginx/1_xieboke.net_bundle.crt;
ssl_certificate_key /root/yzq/djangos/blog/certificate/xiebole.net/Nginx/2_xieboke.net.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
access_log /root/yzq/logs/xieboke.net.access.log;
error_log /root/yzq/logs/xieboke.net.error.log;
if ($server_port = "443") {
return 301 http://$host$request_uri;
}
location / {
uwsgi_pass 127.0.0.1:9090;
include uwsgi_params;
# root html;
# index index.html index.htm;
}
location /media {
alias /root/yzq/djangos/blog/media;
}
location /static {
# alias /root/yzq/djangos/blog/static_root;
proxy_pass http://cdn.xieboke.net/static_root;
# rewrite /static/(.*) http://cdn.xieboke.net/static_root/$1;
}
location /ws/ {
proxy_pass http://127.0.0.1:8001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
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_set_header X-Forwarded-Host $server_name;
}
# 自定义 502 页面
error_page 502 /502.html;
location = /502.html {
root html;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, user-scalable=0, minimal-ui">
<title>服务正在升级中🙂</title>
<style>
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #ddd;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
background-color: white;
margin: 40px auto;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0 0px 2px rgba(0,0,0,0.1);
box-shadow: 0 0px 2px rgba(0, 0, 0, 0.05);
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="container">
<h1>服务正在升级中 <span>🙂</span></h1>
<p>感谢您的访问,服务正在升级,请稍后再试!谢谢。</p>
<div class="links">
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=592006339&site=qq&menu=yes" title="QQ 联系我">QQ 联系我</a>
</div>
</div>
</body>
</html>
/nginx/html
[root@VM_2_29_centos html]# pwd
/usr/local/nginx/html
[root@VM_2_29_centos html]# ls
502.html 50x.html index.html
nginx -s reload