1.域名解析服务器
2.宝塔搭建网站
3.将Django部署到该文件夹下面
4.配置server
{
listen 80;
server_name www.bb1126.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.bb1126.cn/搞笑/;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
#PROXY-START
location ~ /purge(/.*) {
proxy_cache_purge cache_one $host$request_uri$is_args$args;
#access_log /www/wwwlogs/www.bb1126.cn_purge_cache.log;
}
location /
{
proxy_pass http://47.52.70.8:8000;
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 REMOTE-HOST $remote_addr;
#持久化连接相关配置
#proxy_connect_timeout 30s;
#proxy_read_timeout 86400s;
#proxy_send_timeout 30s;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
add_header X-Cache $upstream_cache_status;
expires 12h;
}
location ~ .*\.(php|jsp|cgi|asp|aspx|flv|swf|xml)?$
{
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 REMOTE-HOST $remote_addr;
proxy_pass http://47.52.70.8:8000;
}
location ~ .*\.(html|htm|png|gif|jpeg|jpg|bmp|js|css)?$
{
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 REMOTE-HOST $remote_addr;
proxy_pass http://47.52.70.8:8000;
#缓存相关配置
#proxy_cache cache_one;
#proxy_cache_key $host$request_uri$is_args$args;
#proxy_cache_valid 200 304 301 302 1h;
expires 24h;
}
#PROXY-END
include enable-php-70.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/www.bb1126.cn.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
access_log /www/wwwlogs/www.bb1126.cn.log;
error_log /www/wwwlogs/www.bb1126.cn.error.log;
}
5.反向代理
http://47.52.70.8:8000
多个域名指向一个地址的 配置文件
server
{
listen 80;
server_name www.bb1127.cn www.bb1126.cn www.bm8263.cn www.bb1125.cn www.bb1123.cn www.bb1121.cn www.bb1119.cn www.bb1118.cn www.bb1117.cn www.bb1116.cn www.bb1115.cn www.bb1113.cn www.bb1112.cn www.bm8297.cn www.bm8296.cn www.bm8295.cn www.bm8293.cn www.bm8292.cn www.bm8291.cn www.bm8289.cn www.bm8288.cn www.bm8287.cn www.bm8286.cn www.bm8285.cn www.bm8283.cn www.bm8282.cn www.bm8281.cn www.bm8279.cn www.bm8278.cn www.bm8277.cn www.bm8276.cn www.bm8275.cn www.bm8273.cn www.bm8272.cn www.bm8271.cn www.bm8269.cn www.bm8268.cn www.bm8267.cn www.bm8266.cn www.bm8265.cn;
#server_name www.*;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.bb1126.cn/搞笑/;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP引用配置,可以注释或修改
#PROXY-START
location ~ /purge(/.*) {
proxy_cache_purge cache_one $host$request_uri$is_args$args;
#access_log /www/wwwlogs/www.bb1127.cn_purge_cache.log;
}
location /
{
proxy_pass http://47.52.70.8:8000;
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 REMOTE-HOST $remote_addr;
#持久化连接相关配置
#proxy_connect_timeout 30s;
#proxy_read_timeout 86400s;
#proxy_send_timeout 30s;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";
add_header X-Cache $upstream_cache_status;
expires 12h;
}
location ~ .*\.(php|jsp|cgi|asp|aspx|flv|swf|xml)?$
{
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 REMOTE-HOST $remote_addr;
proxy_pass http://47.52.70.8:8000;
}
location ~ .*\.(html|htm|png|gif|jpeg|jpg|bmp|js|css)?$
{
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 REMOTE-HOST $remote_addr;
proxy_pass http://47.52.70.8:8000;
#缓存相关配置
#proxy_cache cache_one;
#proxy_cache_key $host$request_uri$is_args$args;
#proxy_cache_valid 200 304 301 302 1h;
expires 24h;
}
#PROXY-END
include enable-php-70.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/www.bb1127.cn.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
access_log /www/wwwlogs/www.bb1127.cn.log;
error_log /www/wwwlogs/www.bb1127.cn.error.log;
}
#BINDING-www.bb1126.cn-START
server
{
listen 80;
server_name www.bb1126.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.bb1126.cn/搞笑;
include enable-php-70.conf;
include /www/server/panel/vhost/rewrite/www.bb1127.cn.conf;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log off;
}
access_log /www/wwwlogs/www.bb1127.cn.log;
error_log /www/wwwlogs/www.bb1127.cn.error.log;
}
#BINDING-www.bb1126.cn-END
#BINDING-www.bb1126.cn-START
server
{
listen 80;
server_name www.bb1126.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.bb1126.cn/搞笑;
include enable-php-70.conf;
include /www/server/panel/vhost/rewrite/www.bb1127.cn.conf;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log off;
}
access_log /www/wwwlogs/www.bb1127.cn.log;
error_log /www/wwwlogs/www.bb1127.cn.error.log;
}
#BINDING-www.bb1126.cn-END
#BINDING-www.bb1126.cn-START
server
{
listen 80;
server_name www.bb1126.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.bb1126.cn/搞笑;
include enable-php-70.conf;
include /www/server/panel/vhost/rewrite/www.bb1127.cn.conf;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log off;
}
access_log /www/wwwlogs/www.bb1127.cn.log;
error_log /www/wwwlogs/www.bb1127.cn.error.log;
}
#BINDING-www.bb1126.cn-END