1
我在使用Django + Apache和Nginx構建一個網站來提供我的靜態內容。我的網站的索引不需要任何後端Django編碼,因此我需要在nginx.conf中更改位置/ {}的請求以發送到我的靜態內容中的某個index.html,同時仍允許我的urls.py處理適當的模式?在Django和Nginx上使用靜態索引頁面
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 192.168.1.20:80;
server_name www.example.com example.com;
access_log /home/userxyz/public_html/example.com/logs/nginx_access.log;
error_log /home/userxyz/public_html/example.com/logs/nginx_error.log;
location/
{
proxy_pass http://127.0.0.1:8080;
include /etc/nginx/proxy.conf;
}
location ~ ^/(system|images|robots\.txt|css|js|favicon\.ico).*$
{
root /home/userxyz/public_html/example.com/static-content/;
}
location /media/
{
root /home/userxyz/public_html/example.com/;
}
}