Articles of nginx

How to test drive WordPress on VPS with LEMP stack before going live?

I have example.com up and running on a VPS droplet running Ubuntu 16.04. The website was built with WordPress on LEMP stack (Linux EngineX MySql and PHP) which was done using EeasyEngine. EasyEngine would install the LEMP stack automatically. Suppose I want to experiment with example.com in another location and replace the old live example.com […]

wp-json/ return 404, but wp-json/wp/v2/ works fine on my nginx server

When I access my WordPress site as www.example.com/wp-json/ I got this 404 error. `{“code”:”rest_no_route”,”message”:”No route was found matching the URL and request method”,”data”:{“status”:404}}` But the REST api return the correct json object if I use the url of www.example.com/wp-json/wp/v2/. My permalink is setup as /%year%/%monthnum%/%postname%/, and here is part of my nginx configuration settings: server […]

Nginx rewrite rules

I am having some problems with the Nginx rewrite algorithm for WordPress. I am using this for the rewrite and it works good; server_name www.domain.com domain.com; if ($host != ‘domain.com’) { rewrite ^/(.*) http://domain.com/$1 permanent; } it makes this url; http://domain.com/?author=1 to this; http://domain.com/author/username/ which is good but with an url like this; http://domain.com/?author=1&type=like it […]

How to remove the index.php in the url?

I have installed wordpress in a subdirectory (blog). In the root directory I have installed Magento. Now the file directory is as following: app downloader includes media …. blog/wp-admin My server is nginx. When I set the URL in the wordpress Permalink Settings to: http://www.example.com/blog/index.php/sample-post/ … all the posts are available. Now I want to […]

PHP Code stuck in Cache

Been having a bit of a problem with my site regarding our caching method and my php code not refreshing or flushing. To start, my site is on a dedicated Nginx webserver. I used W3 Total Cache for the initial caching setup. Everything was set up to cache through Memcached. (I should note, my website […]

Remove site root trailing slash

I am using WordPress for a “news” section on a e-commerce site. So the root of the wordpress install is in a sub-folder. www.mysite.com/news I have setup the home & site URL to reflect this in the admin. I also make sure there are no trailing slashes in the permalinks. However, it keeps doing a […]

Cache issues with redis and nginx

I have a problem with the rewrite rules in my nginx config file. I am running wordpress with nginx and redis to cache the site. I can get the redis to cache all pages not a problem, but as I am using jigoshop which when you add a product to the basket submits a form […]

W3 Total Cache Minify Rewrite Error with WordPress on nginx

I’m trying to get W3 Total Cache to rewrite URLs to minified files. I’ve tried every tutorial I could find but I don’t seem to be able to get it right. I keep getting a W3 Total Cache error saying this: It appears Minify URL rewriting is not working. If using apache, verify that the […]

Mysterious HTTP 404 header in my own scripts

I have a WordPress 3.5.1 + nginx configuration. Its nginx configuration is this: server { root /mysite/public_html; server_name wp.mysite; location / { try_files $uri $uri/ /index.php; index index.php index.html index.htm; } location ~ \.php(.*)$ { try_files $uri =404; include /etc/nginx/fastcgi_params; if ($uri !~ “^/uploads/”) { fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; } fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /mysite/public_html$fastcgi_script_name; […]

nginx – permalinks with .php in url not working

I’m moving a site from an Apache server to a nginx server. A lot of the pages have a .php extension at the end of the permalink. Trying to view those pages results in a nginx 404 Not Found. However those pages worked fine on Apache. Here is the server block config for the site: […]