### **Установка Nginx **
####Статический сайт
```shell
apt install nano nginx -y
```
Давайте поправим defalt config
```
nano /etc/nginx/sites-available
```
```shell
server {
listen 80;
server_name staticsite.geekslore.ru;
location / {
root /var/www/html; # Directory containing static files
index index.html index.htm;
try_files $uri $uri/ =404; # Return 404 if the file is not found
}
}
```
Сраничку можно сделать такую
```shell
nano /var/www/html
```
```html
Демо Bootstrap
Привет мир!
```
####Установка сайта на php
```shell
apt install php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip php-intl php-bcmath -y
```
```shell
sudo nano /etc/nginx/sites-available/phpsite
```
```shell
server {
listen 80;
server_name example.com www.example.com;
root /var/www/html/example.com;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|txt)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
```
#### Установка сайта на python
```shell
sudo nano /etc/nginx/sites-available/phpsite
```
```shell
server {
listen 80;
server_name example.com www.example.com;
root /var/www/html/example.com;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|txt)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}