php - Setup Wordpress with Magento using Ngix shows 404 Error -


i using magento2 , fishpig wordpress integration extension , using nginx server. wordpress directory on magento root name "wp".

magento working fine , display blog content when accessing wordpress admin url or frontend shows 404 error page not found.

after research, found have setting in nginx config file (/etc/nginx/sites-available) , setup location of wp directory.

below code have tried add in nginx config file

location  /wp {     index index.php index.html index.htm;     try_files $uri $uri/ /wp/index.php?$args; }     location  /wp {     index index.php index.html index.htm;     try_files $uri $uri/ /index.php?$args; }   location  /wp/wp-admin/ {     index index.php index.html index.htm;     try_files $uri $uri/ /wp/wp-admin/index.php?$args; } 

below url have gone through -:

nginx configuration wordpress blog in subfolder of magento root

https://codex.wordpress.org/nginx

https://www.getpagespeed.com/web-apps/magento-wordpress-integration-nginx

below nginx file.

    server {         listen 80;         listen [::]:80;          listen 443 ssl;         listen [::]:443 ssl;          server_name magento.online.com;         set $mage_root /var/www/html/prod;          ssl_certificate /etc/nginx/ssl/nginx.crt;         ssl_certificate_key /etc/nginx/ssl/nginx.key;          root $mage_root/pub;          index index.php;         autoindex off;         charset utf-8;     #@raj         error_page 404 403 = /errors/404.php;         #add_header "x-ua-compatible" "ie=edge";          # php entry point setup application         location ~* ^/setup($|/) {             root $mage_root;             location ~ ^/setup/index.php {                 fastcgi_pass   fastcgi_backend;                 fastcgi_index  index.php;                 fastcgi_param  script_filename  $document_root$fastcgi_script_name;                 include        fastcgi_params;             }              location ~ ^/setup/(?!pub/). {                 deny all;             }              location ~ ^/setup/pub/ {                 add_header x-frame-options "sameorigin";             }         }          # php entry point update application         location ~* ^/update($|/) {             root $mage_root;              location ~ ^/update/index.php {                 fastcgi_split_path_info ^(/update/index.php)(/.+)$;                 fastcgi_pass   fastcgi_backend;                 fastcgi_index  index.php;                 fastcgi_param  script_filename  $document_root$fastcgi_script_name;                 fastcgi_param  path_info        $fastcgi_path_info;                 include        fastcgi_params;             }              # deny index.php             location ~ ^/update/(?!pub/). {                 deny all;             }              location ~ ^/update/pub/ {                 add_header x-frame-options "sameorigin";             }         }          location / {             try_files $uri $uri/ /index.php?$args;         }    #wordpress code      #   location /wordpress/ {     #       try_files $uri $uri/ /wordpress/index.php?$args;     #   }           location  /wp/wp-admin/ {         index index.php index.html index.htm;         try_files $uri $uri/ /wp/wp-admin/index.php?$args;        }        #   location /wp/wp-admin/ {     #       index index.php index.html index.htm;      #          try_files $uri $uri/ /index.php?$args;     #   }  #end of code          location /pub/ {             location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {                 deny all;             }             alias $mage_root/pub/;             add_header x-frame-options "sameorigin";         }          location /static/ {             # uncomment following line in production mode             # expires max;              # remove signature of static files used overcome browser cache             location ~ ^/static/version {                 rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;             }              location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {                 add_header cache-control "public";                 add_header x-frame-options "sameorigin";                 expires +1y;                  if (!-f $request_filename) {                     rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;                 }             }             location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {                 add_header cache-control "no-store";                 add_header x-frame-options "sameorigin";                 expires    off;                  if (!-f $request_filename) {                 rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;                 }             }             if (!-f $request_filename) {                 rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;             }             add_header x-frame-options "sameorigin";         }          location /media/ {             try_files $uri $uri/ /get.php?$args;              location ~ ^/media/theme_customization/.*\.xml {                 deny all;             }              location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {                 add_header cache-control "public";                 add_header x-frame-options "sameorigin";                 expires +1y;                 try_files $uri $uri/ /get.php?$args;             }             location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {                 add_header cache-control "no-store";                 add_header x-frame-options "sameorigin";                 expires    off;                 try_files $uri $uri/ /get.php?$args;             }             add_header x-frame-options "sameorigin";         }          location /media/customer/ {             deny all;         }          location /media/downloadable/ {             deny all;         }          location /media/import/ {             deny all;         }          # php entry point main application         location ~ (index|get|static|report|404|503)\.php$ {             try_files $uri =404;             fastcgi_pass   fastcgi_backend;             fastcgi_buffers 1024 4k;              fastcgi_param  php_flag  "session.auto_start=off \n suhosin.session.cryptua=off";             fastcgi_param  php_value "memory_limit=768m \n max_execution_time=600";             fastcgi_read_timeout 600s;             fastcgi_connect_timeout 600s;              fastcgi_index  index.php;             fastcgi_param  script_filename  $document_root$fastcgi_script_name;             include        fastcgi_params;         }          gzip on;         gzip_disable "msie6";          gzip_comp_level 6;         gzip_min_length 1100;         gzip_buffers 16 8k;         gzip_proxied any;         gzip_types             text/plain             text/css             text/js             text/xml             text/javascript             application/javascript             application/x-javascript             application/json             application/xml             application/xml+rss             image/svg+xml;         gzip_vary on;          # banned locations (only reached if earlier php entry point regexes don't match)         location ~* (\.php$|\.htaccess$|\.git) {             deny all;         }          }       #     ## optional override of deployment mode. recommend use     ## command 'bin/magento deploy:mode:set' switch modes instead.     ##     ## set $mage_mode default; # or production or developer     ##     ## if set mage_mode in server config, must pass variable     ## php entry point blocks, indicated below. can pass     ## in using:     ##     ## fastcgi_param  mage_mode $mage_mode;     ##     ## in production mode, should uncomment 'expires' directive in /static/ location block 

any appriciated.

when integrating wordpress magento, don't need special rewrites wouldn't normal wordpress working on nginx.

you might not need rewrites @ all. rewrites exist route frontend requests through index.php provide pretty seo urls. functionality of wordpress isn't being used frontend being displayed magento, therefore rewrites may not needed. requests wordpress admin files exist , therefore rewrites shouldn't needed.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -