【发布时间】:2017-11-14 20:05:33
【问题描述】:
我使用 nginx 运行 Symfony2 应用程序,并希望将 wordpress 安装集成到公共网络文件夹的子文件夹中。
例子:
http://www.example.com -> Symfony 2
http://www.example.com/magazin -> Wordpress
通过 Symfony 应用程序的原始 nginx 配置,我可以成功地向 wordpress 的起始页以及整个管理区域(包括插件安装等)发出请求。
但是由于我将 wordpress 配置为对帖子使用自定义 url 方案“年/月/标题”,因此请求以 404 结束。我发现,不是 wordpress 是收到请求的应用程序,而是 symfony ,这当然不知道在这里做什么。 wordpress 为帖子创建的 URL 是正确的(例如 http://www.example.com/magazin/2015/12/my-interesing-post)。
是否可以扩展 nginx 配置以处理特定文件夹“/magazin/”下的所有请求,如果可以,如何?
这是我的 nginx 配置,目前只处理 Symfony2 应用程序:
server {
listen *:80;
server_name www.example.de;
index app.php index.php index.html;
access_log /var/log/nginx/www.example.de.access.log combined;
error_log /var/log/nginx/www.example.de.error.log;
location ~ \.php$ {
root /data/www/www.example.de/current/web;
include /etc/nginx/fastcgi_params;
try_files $uri $uri/ /app.php?$query_string;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index app_prod.php;
fastcgi_param X_FORWARD_PORT "80";
fastcgi_param CUSTOMER_ENV customer_default;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
}
location / {
root /data/www/www.example.de/current/web;
index app.php index.php index.html;
try_files $uri $uri/ /app.php?$query_string;
}
}
【问题讨论】:
标签: php wordpress symfony nginx