« Nginx and Ubuntu » : différence entre les versions
Apparence
Ligne 42 : | Ligne 42 : | ||
= [http://wiki.nginx.org/MediaWiki Mediawiki] = | = [http://wiki.nginx.org/MediaWiki Mediawiki] = | ||
<filebox fn='/etc/nginx/site-availables/mediawiki.conf'> | |||
<filebox fn=/etc/nginx/ | |||
server { | server { | ||
server_name mediawiki.domain.net; | |||
listen 80; | listen 80; | ||
root /var/www/mediawiki; | |||
root / | |||
index index.php; | index index.php; | ||
location ~ \.php$ { | location ~ \.php$ { | ||
include snippets/fastcgi-php.conf; | |||
fastcgi_pass | fastcgi_pass unix:/run/php/php-fpm.sock; | ||
} | } | ||
} | |||
</filebox> | </filebox> | ||
Version du 9 août 2023 à 18:05
Install
ai nginx php-fpm
# check nginx and php-fpm are running
sc-status nginx
sc-status php8.2-fpm
|
UWSGI
ai uwsgi-plugin-php
# uwsgi dependencies: libjansson4 libnorm1 libpgm-5.2-0 libzmq5 uwsgi-core
# uwsgi-plugin-php dependencies: libphp-embed libphp8.2-embed php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
# wrongly install php7.4 dependencies while php8.2 is installed
|
Site configuration
# enable a web site
sudo ln -s /etc/nginx/sites-available/phpinfo.conf /etc/nginx/sites-enabled/phpinfo.conf
sc-restart nginx
|
phpinfo
/etc/nginx/sites-available/phpinfo.conf |
server {
listen 80;
root /var/www/php;
index info.php;
server_name phpinfo.net;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
|
Mediawiki
/etc/nginx/site-availables/mediawiki.conf |
server {
server_name mediawiki.domain.net;
listen 80;
root /var/www/mediawiki;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
|