# 7.2 तीन OS × दोन web servers

Source: https://ravindrabagale.com/mr/aws/ch07-static-website-hosting-3-oses-2-web-servers/7-2-the-hosting-matrix.html
Language: mr (Marathi with English technical terms)

सहा combinations मध्ये कल्पना तीच: files एका folder मध्ये, config त्या folder कडे, योग्य permissions आणि reload. सर्वांसाठी /var/www/mysite वापरतो.

 | OS
 | Web server
 | Install
 | Site config file
 | Document root used
 | Web-server user
 | Extra step

 | Amazon Linux 2023
 | Nginx
 | yum install nginx
 | /​etc/​nginx/​conf.​d/​mysite.​conf
 | /var/www/mysite
 | nginx
 | —

 | Amazon Linux 2023
 | Apache
 | yum install httpd
 | /​etc/​httpd/​conf.​d/​mysite.​conf
 | /var/www/mysite
 | apache
 | —

 | Ubuntu 22.04/24.04
 | Nginx
 | apt install nginx
 | /​etc/​nginx/​sites-​available/​mysite + symlink
 | /var/www/mysite
 | www-data
 | disable default site

 | Ubuntu 22.04/24.04
 | Apache
 | apt install apache2
 | /​etc/​apache2/​sites-​available/​mysite.​conf
 | /var/www/mysite
 | www-data
 | a2ensite, a2dissite 000-​default

 | CentOS Stream 9
 | Nginx
 | yum install nginx
 | /​etc/​nginx/​conf.​d/​mysite.​conf
 | /var/www/mysite
 | nginx
 | firewalld, restorecon

 | CentOS Stream 9
 | Apache
 | yum install httpd
 | /​etc/​httpd/​conf.​d/​mysite.​conf
 | /var/www/mysite
 | apache
 | firewalld, restorecon

Quick default-root पर्याय: AL/CentOS Nginx /usr/share/nginx/html; Ubuntu Nginx /var/www/html; Apache तिन्हीवर सामान्यतः /var/www/html. Custom config असेल तर तो तपासा.

आधी काय तयार हवं?

Running EC2, योग्य public route/IP, SG 80; पुढे HTTPS साठी 443; SSH 22 तुमच्या IP मधून.

AMI नुसार ec2-user/ubuntu किंवा publisher-defined user ने SSH login.

या lab च्या IP:80 वर एकच web server. दुसरा नको असेल तर stop आणि disable.

Lab

तुमचा combination निवडून config path, root आणि worker user लिहा. sudo ss -tlnp | grep :80 ने आधी कोण listening आहे पाहा.

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

Nginx आणि Apache दोघे एकाच IP:80 वर start केले तर Address already in use येईल. दुसऱ्याला आधी stop करा.
