« Nginx and Ubuntu » : différence entre les versions
Apparence
Redirection supprimée vers Ubuntu Balise : Redirection supprimée |
Aucun résumé des modifications |
||
Ligne 8 : | Ligne 8 : | ||
sc-status php8.2-fpm | sc-status php8.2-fpm | ||
</kode> | </kode> | ||
= Site configuration = | |||
== default == | |||
<filebox fn='/etc/nginx/sites-available/default'> | |||
server { | |||
listen 80 default_server; # listen port 80 and set as default server | |||
listen [::]:80 default_server; | |||
root /var/www/html; # root path to the web site folder | |||
index index.html index.htm index.nginx-debian.html; # indexes | |||
server_name _; # server name: my-web-site.net | |||
location / { | |||
# First attempt to serve request as file, then as directory, then fall back to displaying a 404. | |||
try_files $uri $uri/ =404; | |||
} | |||
} | |||
</filebox> | |||
== phpinfo == | |||
<filebox fn='/etc/nginx/sites-available/phpinfo.conf'> | |||
server { | |||
listen 80; | |||
root /var/www/php; | |||
index phpinfo.php; | |||
server_name phpinfo.net; # server name: my-web-site.net | |||
location ~ \.php$ { | |||
include snippets/fastcgi-php.conf; | |||
# With php-fpm (or other unix sockets): | |||
fastcgi_pass unix:/run/php/php8.2-fpm.sock; | |||
} | |||
} | |||
</filebox> |
Version du 8 août 2023 à 21:34
Install
ai nginx php-fpm
# check nginx and php-fpm are running
sc-status nginx
sc-status php8.2-fpm
|
Site configuration
default
/etc/nginx/sites-available/default |
server {
listen 80 default_server; # listen port 80 and set as default server
listen [::]:80 default_server;
root /var/www/html; # root path to the web site folder
index index.html index.htm index.nginx-debian.html; # indexes
server_name _; # server name: my-web-site.net
location / {
# First attempt to serve request as file, then as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
|
phpinfo
/etc/nginx/sites-available/phpinfo.conf |
server {
listen 80;
root /var/www/php;
index phpinfo.php;
server_name phpinfo.net; # server name: my-web-site.net
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}
|