我怎样才能解决这个问题:我想成立Nginx的的conf文件,以满足以下条件:nginx的重写URL子
http://www.example.com/site1/article/index.php?q=hello-world - >http://www.example.com/site1/article/hello-world
HTTB://www.example.com/site2
.php?q = open-new-world - > httb://www.example.com/site3/article/open-new-world
还有多在example.com之后的网站,我想通过使用nginx配置使网址看起来干净。
但我的下面的配置不起作用。谁来帮帮我?
server {
listen 80;
listen [::]:80;
root /var/www/example.com/public_html;
index index.php index.html index.htm;
server_name www.example.com;
location ~ /article/ {
try_files $uri /site1/article/index.php?q=$1;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
}
现在工作!谢谢@理查德史密斯 – Jonash