CGI¶
On serv00.com servers it is possible to run applications based on CGI, FastCGI, SCGI and UWSGI.
Warning
Some applications may require Binexec option to be active
Initial domain setup¶
To run a website that uses CGI, FastCGI, SCGI or UWSGI, you must first ensure the correct configuration of the domain itself. Before proceeding with the next steps, make sure that:
FastCGI configuration¶
Using the .htaccess file you define which requests will be redirected to the FastCGI socket. In order for requests to specific extensions to be handled by FastCGI, add:
AddType application/x-httpd-fastcgi0 .cgi
To redirect all traffic to the FastCGI socket, add:
SetHandler application/x-httpd-fastcgi0
Applications based on FastCGI should be bound to the socket: /usr/home/LOGIN/domains/DOMAIN/fastcgi0.sock and granted permissions: o+rw. Each domain can use up to 10 FastCGI sockets.
For example, socket is selected by typing in .htaccess one of the following lines (support for files with the .cgi extension):
AddType application/x-httpd-fastcgi0 .cgi
AddType application/x-httpd-fastcgi1 .cgi
AddType application/x-httpd-fastcgi2 .cgi
(...)
AddType application/x-httpd-fastcgi9 .cgi
- Redirect all traffic to
FastCGIsocket:
SetHandler application/x-httpd-fastcgi0
SetHandler application/x-httpd-fastcgi1
SetHandler application/x-httpd-fastcgi2
(...)
SetHandler application/x-httpd-fastcgi9
- Each socket (permissions:
o+rw) should be bound to:
/usr/home/login/domains/domain/fastcgi0.sock
/usr/home/login/domains/domain/fastcgi1.sock
/usr/home/login/domains/domain/fastcgi2.sock
(...)
/usr/home/login/domains/domain/fastcgi9.sock
Creating a socket¶
You can create a socket with the command:
spawn-fcgi -M 0777 -F 1 -s /usr/home/LOGIN/domains/DOMAIN/fastcgi0.sock /usr/local/sbin/fcgiwrap
The number 1 is the number of workers, i.e. applications serving CGI scripts at the same time. A smaller number means that if there are more users, some of them may see an error - one worker is able to handle one user at a time, only when the CGI script is finished can it handle the next user.
SCGI configuration¶
Similar to FastCGI, with .htaccess you can serve a page that uses SCGI:
- Specific extension:
AddType application/x-httpd-scgi0 .cgi
- All pages:
SetHandler application/x-httpd-scgi0
Applications based on SCGI should be launched on the server and bound to the socket: /usr/home/LOGIN/domains/DOMAIN/scgi0.sock and granted permissions: o+rw. Similarly to FastCGI, we can run up to 10 sockets.
Configuration of UWSGI¶
Similar to FastCGI, you can serve a page using UWSGI with .htaccess:
- Specific extension:
AddType application/x-httpd-uwsgi0 .cgi
- All pages:
SetHandler application/x-httpd-uwsgi0
Applications based on UWSGI should be launched on the server and bound to the socket: /usr/home/LOGIN/domains/DOMAIN/uwsgi0.sock and granted permissions: o+rw. Similarly to FastCGI, we can run up to 10 sockets.