Ravindra Bagale · AWSसर्व coursesया course चे lessonsशोधाEnglish

AWS · मराठी आवृत्ती

7.11 Combination 6: CentOS Stream 9 + Apache

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

Install → vhost → labels → active firewall rules → configtest → reload हा क्रम:

sudo service nginx stop 2>/dev/null
sudo systemctl disable nginx 2>/dev/null
sudo yum install -y httpd
sudo service httpd start
sudo systemctl enable httpd

sudo tee /etc/httpd/conf.d/mysite.conf > /dev/null <<'EOF'
<VirtualHost *:80>
    ServerName mysite.local
    DocumentRoot /var/www/mysite
    <Directory /var/www/mysite>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorDocument 404 /404.html
    ErrorLog  /var/log/httpd/mysite_error.log
    CustomLog /var/log/httpd/mysite_access.log combined
</VirtualHost>
EOF

sudo restorecon -Rv /var/www/mysite
if systemctl is-active --quiet firewalld; then
  sudo firewall-cmd --permanent --add-service=http --add-service=https
  sudo firewall-cmd --reload
fi
sudo apachectl configtest && sudo service httpd reload
curl -s http://localhost | head -5

Static site मध्ये .htaccess नको असेल तर AllowOverride None वापरा; source मधलं All पुढच्या app exercises साठी दाखवलं आहे.

Lab

Home मध्ये test.html तयार करून योग्य sudo permissions ने web root मध्ये move करा. curl -I http://localhost/test.html पाहा. जुना label अयोग्य असेल तर 403 येऊ शकतो — प्रत्येक setup मध्ये मुद्दाम येईलच असं नाही. ls -Z आणि logs तपासून sudo restorecon -Rv /var/www/mysite; पुन्हा test करा.