最近使用Nginx + PHP-fpm + Apache架設Vitger,遇到一個問題是當在做存檔或狀態變更時,網頁會跳出”您所做的變更為儲存”,當按下離開時,並不會儲存修改後的狀態,發現應該是Nginx設定上的問題,爬文很久終於找到解法,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
location ~ ^<span class="br0">(</span>?<SCRIPT>/.*\.<span class="br0">(</span>php|php3|phtml|suphp<span class="br0">)</span><span class="br0">)</span>$ <span class="br0">{</span> uninitialized_variable_warn off<span class="co0">;</span> set $fpm_url unix:/var/run/php-fpm.sock<span class="co0">;</span> if <span class="br0">(</span>-f /etc/php5/fpm/pool.d/$cur_php_user.conf<span class="br0">)</span> <span class="br0">{</span> set $fpm_url unix:/var/run/php-fpm/$cur_php_user.sock<span class="co0">;</span> <span class="br0">}</span> set $cur_php_user <span class="st0">""</span><span class="co0">;</span> fastcgi_index index.php<span class="co0">;</span> include fastcgi_params<span class="co0">;</span> fastcgi_param SCRIPT_NAME $SCRIPT<span class="co0">;</span> fastcgi_param SCRIPT_FILENAME $document_root$SCRIPT<span class="co0">;</span> fastcgi_pass $fpm_url<span class="co0">;</span> <span class="br0">}</span> location ~ ^<span class="br0">(</span>?<SCRIPT>/.*\.<span class="br0">(</span>php|php3|phtml|suphp<span class="br0">)</span><span class="br0">)</span><span class="br0">(</span>?<PATH_INFO>.*<span class="br0">)</span>$ <span class="br0">{</span> uninitialized_variable_warn off<span class="co0">;</span> if <span class="br0">(</span>$PATH_INFO <span class="sy0">=</span> <span class="st0">""</span><span class="br0">)</span> <span class="br0">{</span> # avoid empty path_info set $PATH_INFO $SCRIPT<span class="co0">;</span> <span class="br0">}</span> set $fpm_url unix:/var/run/php-fpm.sock<span class="co0">;</span> if <span class="br0">(</span>-f /etc/php5/fpm/pool.d/$cur_php_user.conf<span class="br0">)</span> <span class="br0">{</span> set $fpm_url unix:/var/run/php-fpm/$cur_php_user.sock<span class="co0">;</span> <span class="br0">}</span> set $cur_php_user <span class="st0">""</span><span class="co0">;</span> fastcgi_index index.php<span class="co0">;</span> include fastcgi_params<span class="co0">;</span> fastcgi_param PATH_INFO $PATH_INFO<span class="co0">;</span> fastcgi_param PATH_TRANSLATED $document_root$PATH_INFO<span class="co0">;</span> fastcgi_param SCRIPT_NAME $SCRIPT<span class="co0">;</span> fastcgi_param SCRIPT_FILENAME $document_root$SCRIPT<span class="co0">;</span> fastcgi_pass $fpm_url<span class="co0">;</span> <span class="br0">}</span> |