如何在unix socket上使用php-fpm在subdir中设置wordpress?

时间:2014-05-04 22:42:37

标签: wordpress nginx php php-socket

我想将我的wordpress安装从apache迁移到nginx。实际上一切正在发挥作用(至少看起来如此),但重写了网址。

我的设置:

  • php-fpm on unix而不是tcp socket
  • wordpress安装在/ var / www / blog /
  • ubuntu 12.04 lts
  • nginx 1.1.19

nginx documentation for wordpress后我尝试添加

location /blog {
        try_files $uri $uri/ /wordpress/index.php?$args;
}

location ~ \.php$ {
        # ...
        fastcgi_split_path_info ^(/blog)(/.*)$;
}

但这仍然不适合我。你有什么想法?

# /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;
}
}

也改变了www.conf

# /etc/php5/fpm/pool.d/www.conf
# ...
listen = /var/run/php5-fpm.sock
# ...

php.ini更改了cgi.fix_pathinfo

# /etc/php5/fpm/php.ini
# php.ini
# ...
cgi.fix_pathinfo=0
# ...

0 个答案:

没有答案