شما الان توی ریرایت کردن مشکل دارید ؟
این یک کانفیگی هست که قبلا روی انجین اکس با php-fpm انجام دادم و تا مدت ها باهاش کار میکردم
این کانفیگ برای ویرچوال هاست server.ir
در مسیر
/var/htdocs/server.ir/www
برای ریرایت کردن
^/mypages/(.*)/(.*)$ /mypage.php?v=$1&d=$2
هستش
یک نگاهی بهش بندازیید شاید کمک کنه
در ضمن اون هدر های متد option هم اختیاریه و خودم واسه کار خودم تعریف کردم ..
کد:
server {
listen 80;
server_name server.ir
client_max_body_size 120M;
root /var/htdocs/server.ir/www;
location ~* \.php$ {
fastcgi_read_timeout 900;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_intercept_errors on;
}
location / {
root /var/htdocs/server.ir/www;
index index.html index.htm index.php;
if ($request_method = OPTIONS ) {
add_header Content-Length 0;
add_header Content-Type text/plain;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers 'origin, x-requested-with, content-type, accept';
add_header Access-Control-Allow-Methods 'GET, POST';
return 200;
}
try_files $uri $uri/ @router;
}
location @router {
rewrite ^/mypages/(.*)/(.*)$ /mypage.php?v=$1&d=$2 last;
}
}