Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
upstream django {
    server unix:///home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/mysite.sock; # for a file socket
server {
    listen      80;
    server_name mysite.com www.mysite.com; 
    charset     utf-8;
    client_max_body_size 75M;   # adjust to taste

    #--------PHP PART -----------------------
    location /blog {
                alias /var/www;
                try_files $uri =404;
                index index.php index.html;

        location ~ /blog/.+\.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;

        location ~ /\.ht {
                deny all;
    location /media  {
        alias /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/media;

    location /static {
        alias /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/static;

    location / {
        uwsgi_pass  django;
        include     /home/ubuntu/web/www.mysite.com/uwsgi-tutorial/mysite/uwsgi_params;

I have nginx<-->uwsgi<-->django working just fine.
mysite.com [django : working]
mysite.com/blog/index.php [wordpress not working]

INFO : https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 [followed this blog to setup wordpress part]

share|improve this question
What is the problem you are having? –  Michael Hampton Jan 25 at 15:46
i have no idea how to redirect mysite.com/blog to wordpress part using nginx settings. rightnow i am getting nginx 404 file not found –  Sourabh Singh Jan 25 at 15:48
Does it works if you type exactly mysite.com/blog/index.php ? –  adrian7 Jan 25 at 15:52
mysite.com shows django site. but mysite/blog/index.php gives : File not Found.[not 404 nginx] –  Sourabh Singh Jan 25 at 15:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.