NGINX
This example assumes using Alma Linux 8 as the server operating system, first, install NGINX:
Installation
Start and enable the service:
If not already installed, install firewalld
:
If not already running, enable and start the service:
Open up the firewall to allow both HTTP and HTTPS traffic:
Review the changes to the firewall:
Static Site
Update the main NGINX configuration file to include include /etc/nginx/sites-enabled/*.conf;
, for example:
/etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;
}
Create two directories for adding sites:
Then add a basic HTTP configuration for
/etc/nginx/sites-available/exampleforyou.conf
server {
listen 80;
server_name exampleforyou.net www.exampleforyou.net;
access_log /var/log/nginx/www.exampleforyou.net.access_log main;
error_log /var/log/nginx/www.exampleforyou.net.error_log debug;
location / {
root /var/www/exampleforyou.net;
index index.html;
}
}
Create a soft link to activate the site:
Validate the configuration:
Restart the NGINX service: