skip to Main Content

I have a Magento 2 installed in /var/www/html/ folder using mydomain.com and I added a WordPress in /var/www/html/pub/wp/ folder using mydomain.com/wp/
When I tried to access mydomain.com/wp/readme.html it’s working fine but all php files are not accessible so I can’t connect to admin mydomain.com/wp/wp-login.php and see my WordPress.

I added this to my nginx configuration but it’s not working :

location /wp/ {
  index index.html index.php;
  try_files $uri $uri/ /wp/index.php?q=$uri&args;

  location ~ .php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  /wp/index.php;
    include        fastcgi.conf;
  }
}

2

Answers


  1. You have installed WordPress at pub/wp but your Nginx config refers just to /wp/. Either modify your Nginx config to refer to /pub/wp/ or move WordPress to the root (eg. /wp/).

    https://fishpig.co.uk/magento/wordpress-integration/nginx/

    upstream fastcgi_backend {
      server  127.0.0.1:9000;
    }
    
    server {
      listen 80;
    
      # Magento 2 base URL
      server_name m2.latest.composer.fp.com;
    
      # Magento 2 root directory
      set $MAGE_ROOT /home/magento2/html;
    
      set $MAGE_DEBUG_SHOW_ARGS 1;
    
      include /home/magento2/html/nginx.conf.sample;
    
      # WordPress is installed in pub/wp
      location /wp/ {
        index index.html index.php;
        try_files $uri $uri/ /wp/index.php?q=$uri&args;
    
        location ~ .php$ {
          fastcgi_pass   127.0.0.1:9000;
          fastcgi_index  /wp/index.php;
          include        fastcgi.conf;
        }
      }
    }
    
    Login or Signup to reply.
  2. My magento project installed on docker.
    My WP site installed in pub/wp/.
    When installing i used this documentation https://fishpig.co.uk/magento/wordpress-integration/docs/

    I faced with the same problem.

    I resolve this problem by changing fastcgi_pass value to the value what is used in my docker container (fastcgi_backend):

    location /wp/ {
    index index.html index.php;
    try_files $uri $uri/ /wp/index.php$is_args$args;
    location ~ .php$ {
        fastcgi_pass   fastcgi_backend;
        fastcgi_index  /wp/index.php;
        include        fastcgi.conf;
    }
    

    After that you need to change siteurl and home value in wp_options table

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search