VirtualMin WordPress Nginx Permalinks
If you want to use Virtualmin with nginx, there are two nice tutorials (Using Nginx with Virtualmin and Virtualmin with NGINX+PHP-FPM+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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
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:
1 2 3 4 |
location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/php-nginx/143057006117346.sock/socket; } |
Add another location block:
1 |
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:
1 2 3 |
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.
Fonte:Â http://www.vps2.me/2015/05/virtualmin-wordpress-nginx-permalinks.html