Skip to content
LinMax-DevPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Nginx project

References

System Requiremnets

  • 3x Virtual machine running Centos
  • 2 GB of RAM
  • 2 CPU cores

purpose

  • NGINX can save both static and dynamic content . it's a highly optimized for delivering static files like HTML , CSS and images very quickly .
  • it acts an intermediary between client requets and backend servers , offering features like caching , compression and security
  • NGINX can distribute incoming requests across multiple servers, balancing the load to improve availabilty and reliability and handling spikes efficiency . Nginx based on event driven and asynchronous

Steps

  • Install the EPEL repositort and NGINX package

    dnf install epel-release -y
    
    dnf install nginx -y
  • After instalation , you will manage NGINX using the systemd ervice manager

    systemctl start nginx | systemctl enable nginx 
    
  • Open firewall for http and https protocols

    firewall-cmd --permanent --add-service=http |
    firewall-cmd --permanent --add-service=https
    firewall-cmd --reload 
  • Security-Enhanced Linux (SELinux) provides and additional security layer

    setsebool -P httpd_can_network_connect 1 | getsebool httpd_can_network_connect

Configuration Files

Main context : Global setting like worker processes. Events context : Handles connection processing. HTTP context: Configures HTTP serer behavior. Server context: Defines settings for virtual hosts (server blocks). Location context : specifies how to process requests for specific locatios or URLs. Main Context file Main Configuration

Max_clients = worker_processes ✖️ worker_connections

Configuring Error and Access logging Access logs

/var/log/nginx/access.log main; 

Error logs

/var/log/nginx/error.log warn; 

debug logs

/var/log/nginx/error.log debug; 

Document Root and Permissions : NGINX involves defining the document root , which is the directory where website files like index.html are stored server Dont forget to change the root

sudo chown -R nginx:nginx /var/www/html
  • Make custom error page error_page

  • Managing Virtual hosts multiple of websites multiple_websites

Basic URL Rewriting and Redirection

The rewrite allows you to modify the URL before its processed by the server

rewrite ^/oldpage$ /newpage permanent; 

Example rewrite_server

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors