This chapter just downloaded a look at is how to support the php nginx
--
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; }
The main problem here is learning the configuration
--
First, look at the location block, which is a regular match, describes all .php to the end of the section will be resolved here, we are mainly explain how this module php and communication.
--
fastcgi_pass match the port, this is sent to that port handling tell php
--
fasecgi_param Here are some more detailed configuration parameters for the
Look at the parameters of nginx fasecgi_param
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; Path # script file request fastcgi_param QUERY_STRING $ query_string; parameters # request; as ? App = 123 fastcgi_param REQUEST_METHOD $ REQUEST_METHOD; operation (GET, POST) # request fastcgi_param CONTENT_TYPE $ content_type; # request header of the Content - the Type field fastcgi_param CONTENT_LENGTH $ content_length; # request header in the Content - length field. fastcgi_param SCRIPT_NAME $ fastcgi_script_name; # script name fastcgi_param REQUEST_URI $ request_uri; # requested address without parameters fastcgi_param DOCUMENT_URI $ document_uri; # same with $ uri. fastcgi_param DOCUMENT_ROOT $ document_root; # website root directory. Value specified in the instruction root server configuration fastcgi_param SERVER_PROTOCOL $ server_protocol; # request protocol used, usually the HTTP / . 1 .0 or HTTP / 1.1 . GATEWAY_INTERFACE CGI fastcgi_param / 1.1 ; #cgi version fastcgi_param SERVER_SOFTWARE nginx / $ nginx_version; #nginx version number can be modified to hide fastcgi_param REMOTE_ADDR $ remote_addr; # client IP fastcgi_param REMOTE_PORT $ remote_port; # client port fastcgi_param SERVER_ADDR $ server_addr; # server IP address SERVER_PORT $ server_port fastcgi_param; # server port fastcgi_param sERVER_NAME $ server_name; # server name, domain name specified in the server configuration server_name #fastcgi_param PATH_INFO $ PATH_INFO; # can be customized variable # PHP only, required IF PHP WAS Built with - -Force-CGI-enable redirect #fastcgi_param REDIRECT_STATUS 200 is ; in php can print out the above service environment variables such as: echo $ _SERVER [ ' REMOTE_ADDR ' ]
Here are all of the information can be passed over by $ _server, and you can re-configure your own nginx SERVER
E.g:
fastcgi_param DEMO_ENV demo;
Then you can find DEMO_NEV this variable in the $ _SERVER.
--
This also explains why we have to be configured in the nginx and php
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
This sentence to what they do.