Skip to content

Instantly share code, notes, and snippets.

@hendrauzia
Last active December 14, 2015 19:19
Show Gist options
  • Save hendrauzia/5135444 to your computer and use it in GitHub Desktop.
Save hendrauzia/5135444 to your computer and use it in GitHub Desktop.
Apache + PHP with Virtual Host on Ubuntu Server 12.04 LTS
# run as superuser
sudo -s
# install apache
apt-get install apache2 apache2-doc apache2-utils
# install php
apt-get install libapache2-mod-php5 php5 php-pear php5-xcache
# install suhosin
apt-get install php5-suhosin
# install php extension
apt-get install php5-mysql php5-tidy php5-gd
apt-get install curl libcurl3 libcurl3-dev php5-curl
# enable some modules
a2enmod rewrite
# disable default site
a2dissite default
# add site
tee -a /etc/apache2/sites-available/DOMAINNAME <<EOF
<VirtualHost *:80>
ServerName DOMAINNAME
DocumentRoot "/var/apps/APPNAME/"
DirectoryIndex index.php
ErrorLog "/var/apps/APPNAME/logs/error.log"
CustomLog "/var/apps/APPNAME/logs/access.log" combined
<Directory "/var/apps/APPNAME/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
EOF
# enable site
a2ensite DOMAINNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment