How to install Nginx on Ubuntu & Securing with Let's Encrypt

Опубликовано: 21 Декабрь 2022
на канале: Quickloss3
480
22

Update Server:
sudo apt update && apt upgrade -y

Installing Nginx:
sudo apt install nginx -y


Adjusting the Firewall:
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'openSSH'


Checking your Web Server:
systemctl status nginx
curl -4 icanhazip.com

http://server_ip

Setting Up Server Blocks:
sudo mkdir -p /var/www/your_domain/html
sudo chown -R $USER:$USER /var/www/your_domain/html
sudo chmod -R 755 /var/www/your_domain
nano /var/www/your_domain/html/index.html

paste
(watch video)

sudo nano /etc/nginx/sites-available/your_domain

paste
server {
listen 80;
listen [::]:80;

root /var/www/your_domain/html;
index index.html index.htm index.nginx-debian.html;

server_name your_domain www.your_domain;

location / {
try_files $uri $uri/ =404;
}
}

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/

sudo nano /etc/nginx/nginx.conf
...
http {
...
server_names_hash_bucket_size 64;
...
}
...

sudo nginx -t

sudo systemctl restart nginx

http://your_domain

Secure Nginx with Let's Encrypt on Ubuntu

Installing Certbot:
sudo snap install --classic certbot

create a symbolic link to the newly installed /snap/bin/certbot:
sudo ln -s /snap/bin/certbot /usr/bin/certbot

Confirming Nginx’s Configuration:
sudo nano /etc/nginx/sites-available/your_domain
if not then update and save it
sudo nginx -t
sudo systemctl reload nginx

Allowing HTTPS:
sudo ufw status
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
sudo ufw status

Obtaining an SSL Certificate:
sudo certbot --nginx -d your_domain


Смотрите видео How to install Nginx on Ubuntu & Securing with Let's Encrypt онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Quickloss3 21 Декабрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 480 раз и оно понравилось 22 людям.