index:linux:web:nginx:php
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| index:linux:web:nginx:php [2017/10/01 10:38] – créée schermi | index:linux:web:nginx:php [2024/12/17 12:04] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Installation des paquets ===== | ===== Installation des paquets ===== | ||
| + | < | ||
| + | ===== Script de démarrage php ===== | ||
| + | |||
| + | < | ||
| + | < | ||
| + | #!/bin/sh | ||
| + | |||
| + | ### BEGIN INIT INFO | ||
| + | # Provides: | ||
| + | # Required-Start: | ||
| + | # Required-Stop: | ||
| + | # Default-Start: | ||
| + | # Default-Stop: | ||
| + | # Short-Description: | ||
| + | ### END INIT INFO | ||
| + | |||
| + | COMMAND=/ | ||
| + | ADDRESS=127.0.0.1 | ||
| + | PORT=9000 | ||
| + | USER=www-data | ||
| + | GROUP=www-data | ||
| + | PHPCGI=/ | ||
| + | PIDFILE=/ | ||
| + | RETVAL=0 | ||
| + | |||
| + | PHP_FCGI_MAX_REQUESTS=500 | ||
| + | PHP_FCGI_CHILDREN=2 | ||
| + | |||
| + | start() { | ||
| + | export PHP_FCGI_MAX_REQUESTS PHP_FCGI_CHILDREN | ||
| + | $COMMAND -a $ADDRESS -p $PORT -u $USER -g $GROUP -f $PHPCGI -P $PIDFILE | ||
| + | } | ||
| + | |||
| + | stop() { | ||
| + | / | ||
| + | } | ||
| + | |||
| + | case " | ||
| + | start) | ||
| + | start | ||
| + | RETVAL=$? | ||
| + | ;; | ||
| + | stop) | ||
| + | stop | ||
| + | RETVAL=$? | ||
| + | ;; | ||
| + | restart|reload) | ||
| + | stop | ||
| + | start | ||
| + | RETVAL=$? | ||
| + | ;; | ||
| + | *) | ||
| + | echo " | ||
| + | exit 1 | ||
| + | ;; | ||
| + | esac | ||
| + | exit $RETVAL | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | |||
| + | ===== Modification des configurations fastcgi de Nginx ===== | ||
| + | |||
| + | Ajouter ces lignes à la fin du fichier **/ | ||
| + | < | ||
| + | fastcgi_split_path_info ^(.+\.php)(.*)$; | ||
| + | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
| + | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | ||
| + | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| + | </ | ||
| + | |||
| + | ===== Configuration d'un site Nginx avec PHP ===== | ||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | server { | ||
| + | listen 80; | ||
| + | |||
| + | server_name toto.tld; | ||
| + | access_log | ||
| + | error_log | ||
| + | |||
| + | location ~ ^(.+\.php)(/ | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
index/linux/web/nginx/php.1506847089.txt.gz · Last modified: (external edit)
