Outils pour utilisateurs

Outils du site


article:installation_nginx_php_cgi_debian

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
article:installation_nginx_php_cgi_debian [2026/02/02 09:19] estroarticle:installation_nginx_php_cgi_debian [2026/02/03 07:20] (Version actuelle) estro
Ligne 2: Ligne 2:
 [[./|Retour]] [[./|Retour]]
 ---- ----
 +[[https://www.cyberciti.biz/faq/how-to-install-fcgiwrap-for-nginx-on-ubuntu-20-04/|référence cyberciti.biz ]]
 <code bash> <code bash>
 sudo apt-get install nginx php8.4-fpm php8.4-gd php8.4-mysql php8.4-curl php8.4-mbstring php8.4-xml php8.4-sqlite3 sudo apt-get install nginx php8.4-fpm php8.4-gd php8.4-mysql php8.4-curl php8.4-mbstring php8.4-xml php8.4-sqlite3
Ligne 9: Ligne 10:
  
 sudo nano /etc/nginx/fcgiwrap.conf sudo nano /etc/nginx/fcgiwrap.conf
-  location /cgi-bin/ {+</code> 
 +  * <code bash>   
 +    location /cgi-bin/ {
     # Disable gzip (it makes scripts feel slower since they have to complete     # Disable gzip (it makes scripts feel slower since they have to complete
     # before getting gzipped)     # before getting gzipped)
Ligne 27: Ligne 30:
     fastcgi_param SCRIPT_FILENAME  /usr/lib$fastcgi_script_name;     fastcgi_param SCRIPT_FILENAME  /usr/lib$fastcgi_script_name;
   }   }
 +</code>
  
 +<code bash>
 sudo systemctl enable fcgiwrap sudo systemctl enable fcgiwrap
 sudo systemctl start fcgiwrap sudo systemctl start fcgiwrap
 sudo systemctl status fcgiwrap sudo systemctl status fcgiwrap
  
-ajouter dans le fichier du site où un appel à un cgi est souhaité 
-exemple : 
 sudo nano /etc/nginx/sites-enabled/default sudo nano /etc/nginx/sites-enabled/default
-  +# ajouter dans le fichier du site où un appel à un cgi est souhaité 
 +# exemple : 
 +</code> 
 +  * <code bash>  
         ## Trun on /cgi-bin/ support to run CGI apps ##         ## Trun on /cgi-bin/ support to run CGI apps ##
         include /etc/nginx/fcgiwrap.conf;         include /etc/nginx/fcgiwrap.conf;
 +</code>
  
 +<code bash> 
 sudo nginx -t sudo nginx -t
 sudo nginx -s reload sudo nginx -s reload
 sudo mkdir -vp /usr/lib/cgi-bin sudo mkdir -vp /usr/lib/cgi-bin
-sudo nano /usr/lib/cgi-bin/hello.cgi  +sudo nano /usr/lib/cgi-bin/hello.cgi 
-        #!/usr/bin/env bash +</code> 
-        echo "Content-type: text/html" +  * <code bash>  
-        echo "" +#!/usr/bin/env bash 
-        now="$(date)+# ___________________________________________________________________ 
-        echo '<html><head><title>Hello World - CGI app</title></head>' +
-        echo '<body>+# fichier exemple : /usr/lib/cgi-bin/hello.cgi 
-  +# ___________________________________________________________________ 
-        echo '<h2>Hello World!</h2>' + 
-        echo "Computer name : $HOSTNAME<br/>" +echo "
-        echo "The current date and time : ${now}<br/>" +Content-type: text/html 
-        echo '</body>' + 
-        echo '</html>'+<!doctype html> 
 +<html lang="fr"> 
 +<head> 
 +<meta charset="UTF-8"> 
 +<html> 
 +    <head><title>Premier script CGI </title></head> 
 +    <body> 
 +        <h2>Premier script CGI !</h2> 
 +        nom du serveur : $(hostname -f)<br/> 
 +        nous somme le  : $(date +"%A %d %B %Y %R:%S")<br/> 
 +    </body> 
 +</html>
 +</code> 
 + 
 +<code bash> 
 sudo chmod +x -v /usr/lib/cgi-bin/hello.cgi sudo chmod +x -v /usr/lib/cgi-bin/hello.cgi
  
 +# Test dans firefox
 +# http://localhost/cgi-bin/hello.cgi
 </code> </code>
article/installation_nginx_php_cgi_debian.1770023951.txt.gz · Dernière modification : de estro

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki