我怎樣才能解決這個問題:我想成立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