« Nginx and Ubuntu » : différence entre les versions
Apparence
Ligne 16 : | Ligne 16 : | ||
</kode> | </kode> | ||
== | == php == | ||
<filebox fn='/etc/nginx/sites-available/phpinfo.conf' lang=nginx> | <filebox fn='/etc/nginx/sites-available/phpinfo.conf' lang=nginx> | ||
server { | server { | ||
server_name phpinfo.net; | server_name phpinfo.net; | ||
listen 80; | |||
root /var/www/php; | |||
index info.php; | |||
location ~ \.php$ { | location ~ \.php$ { | ||
Ligne 29 : | Ligne 29 : | ||
# With php-fpm (or other unix sockets): | # With php-fpm (or other unix sockets): | ||
fastcgi_pass unix:/run/php/php-fpm.sock; | fastcgi_pass unix:/run/php/php-fpm.sock; | ||
} | |||
} | |||
</filebox> | |||
== .NET == | |||
<filebox fn='/etc/nginx/sites-available/dotnetinfo.conf' lang=nginx> | |||
server { | |||
server_name dotnetinfo.net; | |||
listen 80; | |||
location / { | |||
proxy_pass http://localhost:5000; | |||
proxy_http_version 1.1; | |||
proxy_set_header Upgrade $http_upgrade; | |||
proxy_set_header Connection keep-alive; | |||
proxy_set_header Host $http_host; | |||
proxy_cache_bypass $http_upgrade; | |||
} | } | ||
} | } |
Version du 11 août 2023 à 21:45
Install
ai nginx php-fpm
# check nginx and php-fpm are running
sc-status nginx
sc-status php8.2-fpm
|
Site configuration
# enable a web site
sudo ln -s /etc/nginx/sites-available/phpinfo.conf /etc/nginx/sites-enabled/phpinfo.conf
sc-reload nginx
|
php
/etc/nginx/sites-available/phpinfo.conf |
server {
server_name phpinfo.net;
listen 80;
root /var/www/php;
index info.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
|
.NET
/etc/nginx/sites-available/dotnetinfo.conf |
server {
server_name dotnetinfo.net;
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
}
}
|
Mediawiki
/etc/nginx/site-availables/mediawiki.conf |
Nextcloud
/etc/nginx/sites-available/nextcloud.conf |