У меня есть виртуальный хост, как показано ниже, для моего сайта Yii
server { root /var/www/code; index index.php index.html; server_name example.com; location / { перезаписать ^ / en / keyword $ / en / spesfic_controller / last; .... } }
если я использую последний или перерыв в приведенном выше правиле перезаписи nginx выдает ошибку 404, но если я изменю ее на постоянный, он перенаправит его и будет работать нормально !! что может быть не так? или что я пропустил? (в журнале ошибок ничего нет)
РЕДАКТИРОВАТЬ
полный виртуальный хост ниже:
server { listen 80; root /var/www/code; index index.php index.html; server_name example.com; location / { rewrite ^/[/]*$ /ar/ permanent; proxy_set_header Accept-Encoding ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; } } rewrite ^ / en / jobs-in-riyadh $ "/ en / jobs / SearchResult / city_id / a: 1:% 7Bi: 0; s: 2:% 2210% 22;% 7D" last; error_log /var/log/nginx/error.log warn; access_log /var/log/nginx/access.log; if ($http_user_agent ~ libwww-perl) { return 403; } location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|ttf|woff)$ { access_log off; log_not_found off; expires max; #you can set it to something like 30d; add_header Pragma public; add_header Cache-Control "public"; #you can set more than one COMMA seperated ", must-revalidate, proxy-revalidate"; } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/code/$fastcgi_script_name; fastcgi_buffer_size 4k; fastcgi_buffers 256 4k; fastcgi_max_temp_file_size 0; proxy_buffering off; send_timeout 180s; proxy_read_timeout 120s; proxy_connect_timeout 120s; fastcgi_send_timeout 120s; fastcgi_read_timeout 120s; fastcgi_connect_timeout 120s; } location ~ /\. { access_log off; log_not_found off; deny all; } }