Skip to content

Instantly share code, notes, and snippets.

@smaknsk
Last active October 29, 2015 15:26
Show Gist options
  • Save smaknsk/e13edacf7679cad8c83a to your computer and use it in GitHub Desktop.
Save smaknsk/e13edacf7679cad8c83a to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# ArchLinux Apache Configure
#
#
# Development server packages
#
pacman -S --noconfirm --needed apache php-apache
#
# Configure apache
#
sed -i "s/User http/User $user/" /etc/httpd/conf/httpd.conf
sed -i "s/Group http/Group $group/" /etc/httpd/conf/httpd.conf
# Configure module php5
sed -i "s/LoadModule mpm_event_module modules\/mod_mpm_event.so/LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so/" /etc/httpd/conf/httpd.conf
sed -i "s/#LoadModule rewrite_module/LoadModule rewrite_module/" /etc/httpd/conf/httpd.conf
if ! grep -q 'LoadModule php5_module modules/libphp5.so' /etc/httpd/conf/httpd.conf;
then
cat >> /etc/httpd/conf/httpd.conf << EOL
# PHP 5
LoadModule php5_module modules/libphp5.so
Include conf/extra/php5_module.conf
EOL
fi
if ! grep -q 'application/x-httpd-php php php5' /etc/httpd/conf/httpd.conf;
then
echo "application/x-httpd-php php php5" >> /etc/httpd/conf/mime.types
fi
# Configure port
if ! grep -q 'Listen 8080' /etc/httpd/conf/httpd.conf;
then
sed -i "s/Listen 80/Listen 8080/" /etc/httpd/conf/httpd.conf
fi
# Configure vhost
sed -i "s/#Include conf\/extra\/httpd-vhosts.conf/Include conf\/extra\/httpd-vhosts.conf/" /etc/httpd/conf/httpd.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment