I'm trying to reroute between WordPress and Symfony4, depending on the url entered. Trying to reroute in the nginx file, what am I doing wrong?
I want to use WordPress as front-end, and redirect to a Symfony application when I go onto a specific URL.
For example, when I type in "www.example.com" WordPress is loaded. When I type "www.example.com/blog", the Symfony application is loaded.
So far, I have a Symfony application installed on Nginx, and in the public folder, I've put in two folders, "Blog" and "WordPress". The wordpress folder contains the wordpress files, and the blog folder contains the symfony index file.
I've tried rerouting in the nginx config file.
Below is the code.
server {
listen 80;
listen [::]:80;
server_name blog example.com;
root /var/www/symfony-blog/public/wordpress;
index index.php;
client_max_body_size 100m;
location / {
try_files $uri /index.php;
}
location ~ \.php {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
}
location /blog {
root /var/www/symfony-blog/public/;
index index.php;
}
error_log /var/log/nginx/nginx_error.log;
}
When I type in "www.example.com/blog", it is taken to a WordPress not found page.