3611
Comment: Fix formatting, drop nonexistent category, InterWiki.
|
3629
Typos
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: [[ru/nginx/FastCGI|Russian]]-~ | ~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English -[[ru/nginx/FastCGI|Русский]]-~ |
Line 11: | Line 11: |
To get FastCGI running for the nginx webservice, you will install the debian package '''fcgiwrap'''. | To get FastCGI running for the nginx webservice, you will install the Debian package '''fcgiwrap'''. |
Line 14: | Line 14: |
This setup is done on a debian squeeze system with [[DebianPkg:nginx|nginx 0.7.67-3]] and [[DebianPkg:fcgiwrap|fcgiwrap 1.0-1]]. | This setup is done on a Debian squeeze system with [[DebianPkg:nginx|nginx 0.7.67-3]] and [[DebianPkg:fcgiwrap|fcgiwrap 1.0-1]]. |
Line 53: | Line 53: |
The intresting parts are | The interesting parts are |
Line 73: | Line 73: |
* [[http://wiki.nginx.org/HttpCoreModule#location| location configration]] | * [[http://wiki.nginx.org/HttpCoreModule#location| location configuration]] |
Translation(s): English -Русский
Install and configure FastCGI for nginx Webservice
FastCGI for nginx
To get FastCGI running for the nginx webservice, you will install the Debian package fcgiwrap. Most of the documentation simply tell only aspects of the configuration. For example the SCRIPT_FILENAME and SCRIPT_NAME parameter in the nginx configuration: Both are needed.
This setup is done on a Debian squeeze system with nginx 0.7.67-3 and fcgiwrap 1.0-1.
# apt-get install fcgiwrap
Configure nginx for FastCGI
Add a location configuration for cgi-bin at the proper place.
location ~ ^/cgi-bin/.*\.cgi$ { gzip off; root /var/www/nginx-default; fastcgi_pass unix:/var/run/fcgiwrap.socket; # include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; }
Most part of the fastcgi_param area are copy and pasted by the web sources. The interesting parts are
- root /var/www/nginx-default;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param SCRIPT_NAME $fastcgi_script_name;
The root variable must set to the directory, where the cgi-bin directory lives. If you left the root variable in the location configuration, then nginx uses his default directory /usr/local/nginx/html/cgi-bin/ScriptName.cgi. You cant' use only the full path in the fastcgi_param SCRIPT_FILENAME variable. This won't work!
The fastcgi_param SCRIPT_FILENAME variable set the fullpath of the script. In my example the documentroot and fastcgi_script_name variable are used.
The fastcgi_param SCRIPT_NAME variable set the cgi script filename only.
All three parameters (root, fastcgi_param SCRIPT_FILENAME, fastcgi_param SCRIPT_NAME) are important.