How to install NGINX in ubuntu

Опубликовано: 19 Декабрь 2022
на канале: Quickloss3
451
26

Install Nginx on Ubuntu

Installing Nginx:
sudo apt update && apt upgrade -y
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

Managing the Nginx Process:
stop your web server:
sudo systemctl stop nginx

start the web server when it is stopped:
sudo systemctl start nginx

restart the service again:
sudo systemctl restart nginx

reload without dropping connections:
sudo systemctl reload nginx

By default, Nginx is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior:
sudo systemctl disable nginx

re-enable the service to start up at boot:
sudo systemctl enable nginx


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


Смотрите видео How to install NGINX in ubuntu онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Quickloss3 19 Декабрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 451 раз и оно понравилось 26 людям.