First, I used the symfonyhttp-foundation component. Ajax request end: {code...} php response end: {code...} nginx configuration: {code...} This is returned
First, I used the symfonyhttp-foundation component.
Ajax request end:
$.ajax({ url: jsui.www + 'comment/add', data: $(this).serialize(), type: $(this).attr('method'), error: function(request) { $('.comt-loading').slideUp(300); $('.comt-error').slideDown(300).html(request.responseText); }, success: function(data) {...} ...
Php response end:
Public function add () {// header ('http/1.1 405 Method Not allowed'); // echo 'content'; // exit; // in this case, 200 $ response = new Response ('content405! ', Response: HTTP_METHOD_NOT_ALLOWED, array ('content-type' => 'text/html'); // var_dump ($ response); die (); return $ response ;}
Nginx configuration:
Http {include mime. types; default_type application/octet-stream; # log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"' # '$ status $ response "$ http_referer"' # '"$ http_user_agent" "$ http_x_forwarded_for "'; # access_log logs/access. log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 8080; server_name localhost; # chars Et KOI8-R; # access_log logs/host. access. log main; location/{root E: \ Nginx \ www; index index.html index.htm index. php; if (! -E $ request_filename) {# rewrite ^ /(. *) $/index. php/$1 last; # rewrite ^/newblog/web /(. *) $/newblog/web/index. php/$1 last ;}# error_page 404/404 .html; # redirect server error pages to the static page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root html;} # proxy the PHP scripts to Apache listening on 127.0.0.1: 80 # location ~ \. Php $ {# proxy_pass http://127.0.0.1 #}# Pass the PHP scripts to FastCGI server listening on 127.0.0.1: 9000 # location ~ \. Php {root E: \ Nginx \ www; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_split_path_info ^ (. + \. php )(. *) $; # add the fastcgi_param PATH_INFO $ fastcgi_path_info; # add the fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params ;}
This is returned
Reply content:
First, I used the symfonyhttp-foundation component.
Ajax request end:
$.ajax({ url: jsui.www + 'comment/add', data: $(this).serialize(), type: $(this).attr('method'), error: function(request) { $('.comt-loading').slideUp(300); $('.comt-error').slideDown(300).html(request.responseText); }, success: function(data) {...} ...
Php response end:
Public function add () {// header ('http/1.1 405 Method Not allowed'); // echo 'content'; // exit; // in this case, 200 $ response = new Response ('content405! ', Response: HTTP_METHOD_NOT_ALLOWED, array ('content-type' => 'text/html'); // var_dump ($ response); die (); return $ response ;}
Nginx configuration:
Http {include mime. types; default_type application/octet-stream; # log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"' # '$ status $ response "$ http_referer"' # '"$ http_user_agent" "$ http_x_forwarded_for "'; # access_log logs/access. log main; sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 8080; server_name localhost; # chars Et KOI8-R; # access_log logs/host. access. log main; location/{root E: \ Nginx \ www; index index.html index.htm index. php; if (! -E $ request_filename) {# rewrite ^ /(. *) $/index. php/$1 last; # rewrite ^/newblog/web /(. *) $/newblog/web/index. php/$1 last ;}# error_page 404/404 .html; # redirect server error pages to the static page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root html;} # proxy the PHP scripts to Apache listening on 127.0.0.1: 80 # location ~ \. Php $ {# proxy_pass http://127.0.0.1 #}# Pass the PHP scripts to FastCGI server listening on 127.0.0.1: 9000 # location ~ \. Php {root E: \ Nginx \ www; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_split_path_info ^ (. + \. php )(. *) $; # add the fastcgi_param PATH_INFO $ fastcgi_path_info; # add the fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params ;}
This is returned
This should be irrelevant to nginx.