DEV Community

Discussion on: Wordpress blog in a Rails app subfolder 🙈

Collapse
 
codebjorn profile image
Dorin Lazar

I had such experience using Laravel app and for blog WordPress app. To make it possible I used nginx web server
The idea is pretty simple:

  1. Setup app folders, as example
var/www/laravel -> laravel app
var/www/wp -> wp app
Enter fullscreen mode Exit fullscreen mode
  1. Setup nginx server block
server {
    listen 80;
    index index.php index.html;
    root /var/www/laravel;

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

    location /blog {
      alias /var/www/wp;
   }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
leewynne profile image
Lee Wynne

Thanks!