# 6.4 Amazon Linux 2023 वर Nginx आणि Apache

Source: https://ravindrabagale.com/mr/aws/ch06-web-servers-nginx-and-apache/6-4-amazon-linux-2023.html
Language: mr (Marathi with English technical terms)

आधी तुमचा OS AL2023 आहे का पाहा. एकाच port 80 वर दोन्ही servers एकाचवेळी start करू नका.

Nginx

sudo yum install -y nginx
sudo service nginx start
sudo systemctl enable nginx
sudo service nginx status
sudo nginx -t                              # test configuration syntax
curl -I http://localhost                   # expect HTTP/1.1 200 OK
ls /usr/share/nginx/html                   # default web root

Install → start → enable → status → nginx -t → localhost HTTP check. Default root /usr/share/nginx/html.

Apache

Nginx stop केल्यावर पुढचे commands वापरा:

sudo yum install -y httpd
sudo service httpd start
sudo systemctl enable httpd
sudo service httpd status
sudo apachectl configtest                  # expect "Syntax OK"
echo "<h1>Apache on Amazon Linux 2023</h1>" | sudo tee /var/www/html/index.html
curl http://localhost

जुनं Amazon Linux 2 example

Source course मध्ये Apache साठी sudo yum install -y httpd आणि Nginx साठी sudo amazon-linux-extras install -y nginx1 दिलं आहे. नवीन lab साठी supported OS/version निवडा; AL2 instructions AL2023 मध्ये वापरू नका.

Default test page स्वतःच्या content ने बदला. Version exposure कमी करण्यासाठी Chapter 8.8 पाहा; version लपवणं हे updates/access control चा पर्याय नाही.

Lab

Nginx install करून curl -I http://localhost मध्ये status/header पाहा. मग sudo service nginx stop, Apache install/start आणि curl http://localhost ने custom page तपासा.

रवींद्र बागले यांची tip

आधी localhost वर curl करा. तिथे चालतं पण बाहेर नाही तर SG, routes, bind address, public IP, firewall आणि http/https फरक तपासा.
