Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Setup apache with python-cgi without extension, Remove test file
- xterm -title "PACKAGES FOR APACHE2" -e apt-get install --yes python3 apache2 python-scgi pycsw-wsgi figlet
- figlet Apache
- rm /var/www/html/index.html
- touch /var/www/html/hello
- chmod a+x /var/www/html/hello
- firewall-cmd --add-service=http --permanent
- firewall-cmd --reload
- /lib/systemd/systemd-sysv-install enable apache2
- systemctl enable apache2
- systemctl start apache2.service
- echo "127.0.0.1 deb.example.com" >> /etc/hosts
- echo "<virtualhost *:80>" >> /etc/apache2/apache2.conf
- echo "servername deb.example.com" >> /etc/apache2/apache2.conf
- echo "documentroot /var/www/html/" >> /etc/apache2/apache2.conf
- echo "</virtualhost>" >> /etc/apache2/apache2.conf
- echo "<directory /var/www/html/*>" >> /etc/apache2/apache2.conf
- echo "require all granted" >> /etc/apache2/apache2.conf
- echo "options ExecCGI" >> /etc/apache2/apache2.conf
- echo "options all" >> /etc/apache2/apache2.conf
- echo "sethandler cgi-script" >> /etc/apache2/apache2.conf
- echo "AllowOverride None" >> /etc/apache2/apache2.conf
- echo "addhandler cgi-script .py" >> /etc/apache2/apache2.conf
- echo "addhandler mod_python .py" >> /etc/apache2/apache2.conf
- echo "</directory>" >> /etc/apache2/apache2.conf
- echo "<FilesMatch "^[^\.]+$ ">" >> /etc/apache2/apache2.conf
- echo "SetHandler cgi-script" >> /etc/apache2/apache2.conf
- echo "</FilesMatch>" >> /etc/apache2/apache2.conf
- ################
- echo "#!/usr/bin/python3" >> /var/www/html/hello
- echo "print('Content-type:text/html')" >> /var/www/html/hello
- echo "print()" >> /var/www/html/hello
- echo "print('<HTML><BODY>HELLO</BODY></HTML>')" >> /var/www/html/hello
- a2enmod cgi
- systemctl restart apache2.service
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement