I want to migrate my wordpress installation from apache to nginx. Actually everything is working (at least it seems so) but the rewriting of urls.
My setup:
- php-fpm on unix instead tcp socket
- wordpress installation in /var/www/blog/
- ubuntu 12.04 lts
- nginx 1.1.19
Following the nginx documentation for wordpress I tried to add
location /blog {
try_files $uri $uri/ /wordpress/index.php?$args;
}
location ~ .php$ {
# ...
fastcgi_split_path_info ^(/blog)(/.*)$;
}
But this is still not working for me. Do you have any ideas?
# /etc/nginx/sites-enabled/default
server {
listen 80;
root /var/www/blog;
index index.php;
server_name 12.34.56.789; # server isn't connected with a domain for now
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { allow all; log_not_found off; access_log off; }
location ~ /. { deny all; }
location ~* /(?:uploads|files)/.*.php$ { deny all; }
location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
location ~ .php$ {
fastcgi_split_path_info ^(/blog)(/.*)$;
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
also changed www.conf
# /etc/php5/fpm/pool.d/www.conf
# ...
listen = /var/run/php5-fpm.sock
# ...
php.ini changed cgi.fix_pathinfo
# /etc/php5/fpm/php.ini
# php.ini
# ...
cgi.fix_pathinfo=0
# ...