VirtualMin WordPress Nginx Permalinks
If you want to use Virtualmin with nginx, there are two nice tutorials. The first is a guide on using Nginx with Virtualmin. The second is a guide on using Virtualmin with NGINX, PHP-FPM and OPCACHE
To get the WordPress permalinks to work, do the following:
Go to Virtualmin > Services > Configure Nginx Website > Return to virtual hosts list > Edit Configuration Files.
Locate the configuration for the specific website:
Locate the configuration for the specific website: server { server_name vps2.me www.vps2.me; listen 45.64.105.90; root /home/vps2/public_html; index index.html index.htm index.php; access_log /var/log/virtualmin/vps2.me_access_log; error_log /var/log/virtualmin/vps2.me_error_log; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME /home/vps2/public_html$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT /home/vps2/public_html; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_param HTTPS $https; location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/var/php-nginx/143057006117346.sock/socket; } listen 45.64.105.90:443 ssl; ssl_certificate /home/taxtitans/ssl.cert; ssl_certificate_key /home/taxtitans/ssl.key; rewrite_log off; }
After the first location block:
location ~ .php$ { try_files $uri =404; fastcgi_pass unix:/var/php-nginx/143057006117346.sock/socket; }
Add another location block:
location / { try_files $uri $uri/ /index.php?$args; }
Now, save changes and click “Apply Nginx Configuation” to restart Nginx.
If you have installed WordPress in a folder, add the following location block:
location /name-of-folder { try_files $uri $uri/ /name-of-folder/index.php?q=$uri$is_args$args; }
Save and apply changes.
You can also achieve this by making the same changes to the “nginx.conf” file which is located at “etc/nginx”. Open the file in nano with the command:
nano nginx.conf
Make the changes, save the file and restart nginx with the command
service nginx restart
Make sure the cache (WP Super Cache) is cleared. If you still have problems, try with the ‘Nginx Helper’ plugin.