Last active
December 18, 2015 16:38
-
-
Save Starefossen/5812468 to your computer and use it in GitHub Desktop.
Vagrant (precise32) configuration for php5-fpm and nginx. Simply place these files in any directory and run __vagrant up__.
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
apt-get update | |
apt-get install -y php5-fpm php5-pgsql php5-curl nginx | |
sed -i 's/127.0.0.1:9000/\/tmp\/php5-fpm.sock/' /etc/php5/fpm/pool.d/www.conf # listen to socket instead of port | |
sed -i 's/display_errors = Off/display_errors = On/' /etc/php5/fpm/php.ini | |
sed -i 's/display_startup_errors = Off/display_startup_errors = On/' /etc/php5/fpm/php.ini | |
service php5-fpm restart | |
rm /etc/nginx/sites-enabled/default | |
ln -s /vagrant/default /etc/nginx/sites-enabled/default | |
service nginx restart |
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
server { | |
listen 80; ## listen for ipv4; this line is default and implied | |
listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
root /vagrant/; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name _; | |
location / { | |
try_files $uri $uri/ /index.php; | |
} | |
location /doc/ { | |
alias /usr/share/doc/; | |
autoindex on; | |
allow 127.0.0.1; | |
deny all; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
#error_page 500 502 503 504 /50x.html; | |
#location = /50x.html { | |
# root /usr/share/nginx/www; | |
#} | |
# pass the PHP scripts to FastCGI server listening on /tmp/php5-fpm.sock | |
# | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/tmp/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise32" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
config.vm.provision :shell, :path => "bootstrap.sh" | |
config.vm.network :forwarded_port, guest: 80, host: 8080 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment