nginx

  sudo apt-get update
  sudo apt-get install nginx

systemctl status nginx

root@Fenrir:/etc/nginx/sites-enabled# systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server

   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-02-13 22:03:25 CET; 17h ago
     Docs: man:nginx(8)
  Process: 80518 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 80519 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 82155 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
 Main PID: 80521 (nginx)
    Tasks: 5 (limit: 9409)
   Memory: 6.5M
   CGroup: /system.slice/nginx.service
           ├─80521 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─82156 nginx: worker process
           ├─82157 nginx: worker process
           ├─82158 nginx: worker process
           └─82159 nginx: worker process

sudo adduser $USER www-data

chown www-data:www-data /var/www -Rf

sudo mkdir -p /var/www/monsite.local/html

nano /var/www/monsite.local/html/index.html

<head> <title>Site de monsite.local</title> </head> <body> <h1>Cool ! Le site monsite.local est opérationnel</h1> </body>

sudo nano /etc/nginx/sites-available/monsite.local

server { listen 80; listen [::]:80; root /var/www/monsite.local/html; index index.html index.htm index.nginx-debian.html; server_name monsite.local www.monsite.local; location / { try_files $uri $uri/ =404; } }

sudo ln -s /etc/nginx/sites-available/monsite.local /etc/nginx/sites-enabled/

sudo apt-get install php-fpm

sudo nano /etc/nginx/sites-available/primtux.local server { listen 80; listen [::]:80; root /var/www/monsite.local/html; index index.php index.html index.htm index.nginx-debian.html; server_name monsite.local www.monsite.local; location / { try_files $uri $uri/ =404; }

  location ~ \.php$ {
      include snippets/fastcgi-php.conf;
      fastcgi_pass unix:/run/php/php7.3-fpm.sock;
  }
  location ~ /\.ht {
      deny all;
  }

}

nano /var/www/monsite.local/html/index.php

<?php phpinfo(); ?>

  • nginx.txt
  • Dernière modification: 2020/02/14 15:40
  • par crust