Created
January 8, 2015 22:27
-
-
Save BlakePetersen/fc08600dc2f88fbabd77 to your computer and use it in GitHub Desktop.
HHVM/nginx Vagrant Bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
###### -- Installs and configures HHVM to run on nginx | |
### Add Dependency Repos | |
echo ' -=-=- Adding Dependency Repositories and Updating Packages' | |
sudo add-apt-repository -y ppa:nginx/stable | |
apt-get update | |
### Install Essentials | |
echo ' -=-=- Installing Essentials...' | |
apt-get install -y unzip vim git-core curl wget build-essential python-software-properties | |
### Install nginx | |
echo ' -=-=- Installing nginx...' | |
apt-get -y install nginx | |
### Install HHVM | |
echo ' -=-=- Installing HHVM...' | |
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - | |
echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list | |
apt-get update | |
apt-get install -y hhvm | |
### Post-install HHVM scripts | |
echo ' -=-=- Running HHVM Post-Install Scripts...' | |
/usr/share/hhvm/install_fastcgi.sh | |
update-rc.d hhvm defaults | |
service hhvm restart | |
/usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60 | |
### Configure Virtual Hosts | |
echo ' -=-=- Configuring Virtual Hosts...' | |
# Remove Defaults | |
sudo rm /etc/nginx/sites-available/default | |
sudo rm /etc/nginx/sites-enabled/default | |
# Create WebSockets-friendly Virtual Hosts Entry | |
echo ' | |
server { | |
listen 80 default_server; | |
root /vagrant; | |
index index.html index.htm index.php; | |
access_log /var/log/nginx/vagrant.access.log; | |
error_log /var/log/nginx/vagrant.error.log; | |
large_client_header_buffers 8 32k; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { log_not_found off; access_log off; } | |
location = /robots.txt { log_not_found off; access_log off; } | |
error_page 404 /index.php; | |
include hhvm.conf; | |
} | |
' > /etc/nginx/sites-available/vagrant | |
# Symlink into 'Sites Enabled | |
ln -s /etc/nginx/sites-available/vagrant /etc/nginx/sites-enabled/vagrant | |
# Restart nginx | |
service nginx stop | |
service nginx start | |
# Add entry to Hosts | |
echo '127.0.0.1 vagrant' >> /etc/hosts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provision :shell, path: "hhvm-nginx-vagrant-bootstrap.sh" | |
config.vm.network :forwarded_port, host: 4567, guest: 80 | |
config.vm.provider "virtualbox" do |v| | |
v.name = "HHVM/nginx Vagrant Instance" | |
v.customize ["modifyvm", :id, "--memory", "2048"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment