nginx
server{
listen 80;
server_name genghenggao.top www.genghenggao.top;
# server_name 39.105.175.144;
charset utf-8;
client_max_body_size 1024M;
location /media {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /usr/local/wjproject_docker/wjproject_env/media/;
}
location /static {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /usr/local/wjproject_docker/wjproject_env/static/;
}
location / {
root /usr/local/wjproject_docker/wjproject_env/wjproject_ui/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api{
# 配置代理路径
proxy_pass http://127.0.0.1:8000/api;
}
location /admin{
# 配置Django后台
proxy_pass http://127.0.0.1:8000/admin;
}
}
# Django转发请求到Nginx:127.0.0.1:8000
server {
listen 8000;
server_name localhost 127.0.0.1;
client_max_body_size 1024M;
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass 127.0.0.1:8002;
}
}
server {
# Vue端口
listen 8004;
server_name genghenggao.top www.genghenggao.top;
client_max_body_size 1024M;
# server_name 39.105.175.144;
location / {
root /usr/local/wjproject_docker/wjproject_env/wjproject_ui/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
# 配置代理路径
location /api{
proxy_pass http://127.0.0.1:8000/api;
}
}
你只管努力,其他的交给天意~