Installing Nginx
Nginx is web server software for dynamic processing of user requests, being a leader in its niche and used by major IT companies VKontakte, Google, Facebook and others.
Installing Nginx
Enter the Nginx installation command:
apt-get install nginx -yConfiguring Nginx
Go to sFTP at address /etc/nginx/sites-available and create a file server_name.conf (name can be anything), containing the following text with your data:
server {
listen *:80;
server_name aeza.net; # site domain
client_max_body_size 1000M; # maximum file size transmitted through the site
error_page 404 = @notfound;
location / {
root /home/site/aeza; # path to the site
try_files $uri $uri.html $uri/ @extensionless-php;
index index.html index.php;
}
# PHP connections, if not needed, then delete from line 12 to 19
location ~ \.(php|html|htm)$ {
try_files $uri =404;
root /home/site/aeza; # path to the site
fastcgi_pass unix:/run/php/php7.0-fpm.sock; # path to php
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
}
}Reload Nginx:
service nginx restartConnecting PHP to Nginx
PHP is not required for working with Nginx. Use this part only for sites that require PHP script execution.
Run the following commands sequentially:
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
sudo apt-get -y install php7.4 php7.4-{mcrypt,mysql,fpm}Reload Nginx:
service nginx restartEnabling SSL (encryption protocol)
Is an optional item that increases trust in your site
Modify the previously created config, bringing it to the following form
server {
listen 80;
server_name aeza.net; # site domain
return 301 https://$server_name$request_uri; # redirect from http to https
}
server {
listen 443 ssl http2;
server_name aeza.net; # site domain
root /var/www/aeza; # path to the site
index index.html index.htm index.php; # index pages
access_log /var/log/nginx/aeza.app-access.log; # logs of successful connections
error_log /var/log/nginx/aeza.app-error.log error; # logs of erroneous connections
# if something needs to be disabled, instead of the path to the file we write "off"
client_max_body_size 1000m; # maximum file size transmitted through the site
client_body_timeout 120s; # timeout value
sendfile off; # after enabling Nginx will send HTTP response headers in one packet, not in separate parts.
# SSL settings
ssl_certificate /etc/letsencrypt/live/aeza.net/fullchain.pem; # SSL certificate public key
ssl_certificate_key /etc/letsencrypt/live/aeza.net/privkey.pem; # SSL certificate private key
ssl_session_cache shared:SSL:10m; # SSL session cache volume
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
ssl_prefer_server_ciphers on; # reduces site page loading time
location ~ \.(php|html|htm)$ {
try_files $uri =404;
root /var/www/aeza; # path to the site
fastcgi_pass unix:/run/php/php7.2-fpm.sock; # path to php file
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
}
}Reload Nginx:
service nginx restartChecking for Apache2
When using Nginx with Apache2, they will not be able to work correctly, conflicting for port - 80. Therefore, it is important to remove one of the web server software.
Check for Apache2:
service apache2 statusIf you don't see a large message with information, then Apache2 is not installed.
To remove Apache2, enter:
apt-get remove --purge apache2* -yRemoving Nginx
To remove Nginx, enter the command to stop it:
service nginx stopAnd then the command to completely remove Nginx:
apt-get remove --purge nginx*Installing MikroTik RouterOS (CHR) on a virtual server
Cloud Hosted Router is a version of Mikrotik RouterOS designed for deployment on virtual machines as a standalone operating system.
What is KMI and how to use it?
KMI is a microservice from the Aeza team for anonymous and fast saving and storing any text information.