代码拉取完成,页面将自动刷新
# django连接组件
upstream django1{
server unix:///tmp/uwsgi_1.sock; # sock,名字随意,后边要保持一致
}
server {
listen 80; # http
server_name guohtgo.asuscomm.com;
set $flag 0;
# 禁止ip访问
if ($host != 'guohtgo.asuscomm.com'){
# return 403;
set $flag "${flag}1";
}
if ($host != '192.168.1.30'){
# return 403;
set $flag "${flag}1";
}
if ($flag = "011"){
return 403;
}
rewrite ^(.*) http://$server_name:8001$1 permanent; #或者 rewrite ^(.*) https://$host$1 permanent
}
server {
listen 443 ssl; # https
server_name guohtgo.asuscomm.com;
set $flag 0;
# 禁止ip访问
if ($host != 'guohtgo.asuscomm.com'){
# return 403;
set $flag "${flag}1";
}
if ($host != '192.168.1.30'){
# return 403;
set $flag "${flag}1";
}
if ($flag = "011"){
return 403;
}
rewrite ^(.*) https://$server_name:8002$1 permanent; #或者 rewrite ^(.*) https://$host$1 permanent
}
server {
listen 8001; # http
server_name guohtgo.asuscomm.com;
set $flag 0;
# 禁止ip访问
if ($host != 'guohtgo.asuscomm.com'){
# return 403;
set $flag "${flag}1";
}
if ($host != '192.168.1.30'){
# return 403;
set $flag "${flag}1";
}
if ($flag = "011"){
return 403;
}
rewrite ^(.*) https://$server_name:8002$1 permanent; #或者 rewrite ^(.*) https://$host$1 permanent
}
server {
# 监视的网站端口
listen 8002 ssl; # https
server_name guohtgo.asuscomm.com;
set $flag 0;
#禁止ip访问
if ($host != 'guohtgo.asuscomm.com'){
# return 403;
set $flag "${flag}1";
}
if ($host != '192.168.1.30'){
# return 403;
set $flag "${flag}1";
}
if ($flag = "011"){
return 403;
}
#ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
#UTF-8编码
charset utf-8;
# 最大上传大小128M,可自由定义
client_max_body_size 900M;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
# 媒体文件(上传)
location /upload_files {
alias /home/pi/Code/Django_proj/MyTools/upload_files; # 不在静态文件中
}
# 页面icon
location /favicon.ico {
alias /home/pi/Code/Django_proj/MyTools/static/img/tools-icon.png;
}
# 静态文件
location /static {
alias /home/pi/Code/Django_proj/MyTools/static;
}
# 其他交由django处理
location / {
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
uwsgi_pass django1;
include uwsgi_params; # uwsgi
proxy_set_header Host $http_host;
}
location /webssh/ {
proxy_pass http://127.0.0.1:8888/;
proxy_http_version 1.1;
proxy_read_timeout 300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。