I have to run wordpress and laravel side by side on the nginx server. The url structure required is example.com (to show the wordpress content) and example.com/testapp (for the laravel application). The config I am using for nginx currently, is doing just opposite.

    server {
    listen 80 default_server;
    server_name default;
    root /home/forge/default/public;
    #root /home/forge/apen;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/default-error.log error;
    error_page 404 /index.php;

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;

    location ~ /.ht {
        deny all;

Its handling all the routes starting with example.com except for example.com/testapp through laravel. example.com/testapp is serving the wordpress content. WordPress folder is saved inside public folder of laravel.

I installed the wordpress seprately and and tried to create a separate server names in /etc/nginx/sites-available one for example.com and another for example.com/testapp. After this example.com is showing the wordpress content but example.com/testapp is not loading laravel content.

Read more here: Unable to run the wordpress and laravel side by side on nginx according to specified url structure


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: