I have a Django application running in a domain, for example. www.example.com
I want to create a Wordpress landing page and point this landing page to the home URL www.example.com and the wordpress website at www.example.com/admin or www.example.com/wp-admin. All other URLs must be served by Django.
So I want:
- www.example.com → wordpress
- www.example.com/admin or www.example.com/wp-admin → wordpress
- All other URLs that will be served by Django
So far, this is my Nginx configuration using Django:
upstream django_server {
server unix:/path/to/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.example.com example.com
client_max_body_size 4G;
access_log /path/to/nginx-access.log;
error_log /path/to/nginx-error.log;
location /static/ {
alias /path/to/static/;
}
location /media/ {
alias /path/to/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://django_server;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /path/to/static/;
}
}
Any help would be greatly appreciated.
source
share