0

How can WordPress be made to live at /blog, while another application handles the root directory /, using nginx? Below is my nginx config but i keep getting 404 error... Any solution that works??

location /blog {
       root  /var/www/html/wordpress;
       index index.php index.htm index.html;
       try_files $uri $uri/ /blog/index.php?$args;
}


location ~ \.php$ {
    root  /var/www/html/wordpress;
    try_files  $uri =404;
    fastcgi_read_timeout            3600s;
    fastcgi_buffer_size             128k;
    fastcgi_buffers                 4128k;
    fastcgi_pass                    unix:/run/php/php7.2-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index                   index.php;
    fastcgi_split_path_info ^(/blog)(/.*)$;
}

location ~* ^.+.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom$
    access_log                      off;
    log_not_found                   off;
    expires                         max;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.